Skip to content

Commit

Permalink
Merge pull request #8621 from JinShil/fix_19193
Browse files Browse the repository at this point in the history
Issue 19193 - deprecated attribute on enum members in templates is ignored
  • Loading branch information
MartinNowak committed Aug 29, 2018
2 parents 6e53e55 + edc9310 commit 5d124c1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/dmd/denum.d
Expand Up @@ -395,7 +395,13 @@ extern (C++) final class EnumMember : VarDeclaration
override Dsymbol syntaxCopy(Dsymbol s)
{
assert(!s);
return new EnumMember(loc, ident, value ? value.syntaxCopy() : null, origType ? origType.syntaxCopy() : null);
return new EnumMember(
loc, ident,
value ? value.syntaxCopy() : null,
origType ? origType.syntaxCopy() : null,
storage_class,
userAttribDecl ? cast(UserAttributeDeclaration)userAttribDecl.syntaxCopy(s) : null,
depdecl ? cast(DeprecatedDeclaration)depdecl.syntaxCopy(s) : null);
}

override const(char)* kind() const
Expand Down
22 changes: 22 additions & 0 deletions test/fail_compilation/test19193.d
@@ -0,0 +1,22 @@
/*
REQUIRED_ARGS: -de
TEST_OUTPUT
---
fail_compilation/test19193.d(13): Deprecation: enum member `test19193.T19193!int.A.b` is deprecated
---
*/

// https://issues.dlang.org/show_bug.cgi?id=19193

void main ()
{
cast(void)T19193!int.A.b;
}

template T19193(T)
{
enum A
{
deprecated b
}
}

0 comments on commit 5d124c1

Please sign in to comment.