Skip to content

Commit

Permalink
Keep backward compatibility of ddoc generation for template with anon…
Browse files Browse the repository at this point in the history
…ymous enum
  • Loading branch information
9rnsr committed Oct 6, 2015
1 parent 9e1e61d commit f9aa4c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module ddmd.doc;

import core.stdc.ctype;
import core.stdc.stdlib;
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.time;
import ddmd.aggregate;
Expand Down Expand Up @@ -329,6 +330,8 @@ extern (C++) static Dsymbol getEponymousMember(TemplateDeclaration td)
return ad;
if (FuncDeclaration fd = td.onemember.isFuncDeclaration())
return fd;
if (auto em = td.onemember.isEnumMember())
return null; // Keep backward compatibility. See compilable/ddoc9.d
if (VarDeclaration vd = td.onemember.isVarDeclaration())
return td.constraint ? null : vd;
return null;
Expand Down
5 changes: 5 additions & 0 deletions test/compilable/ddoc9.d
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ struct Struct(T) { }
/// Union Documentation
union Union(T) { }

/// Template documentation with anonymous enum
template TemplateWithAnonEnum(T)
{
enum { TemplateWithAnonEnum = 1 }
}
4 changes: 4 additions & 0 deletions test/compilable/extra-files/ddoc9.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ <h1>ddoc9</h1>
</big></dt>
<dd><u>Union</u> Documentation<br><br>

</dd>
<dt><big><a name="TemplateWithAnonEnum"></a>template <u>TemplateWithAnonEnum</u>(T)</big></dt>
<dd>Template documentation with anonymous enum<br><br>

</dd>
</dl>

Expand Down

0 comments on commit f9aa4c9

Please sign in to comment.