Skip to content

Commit

Permalink
Merge pull request #3266 from 9rnsr/fix12160
Browse files Browse the repository at this point in the history
[REG2.065a] Issue 12160 - UDA related regressions
  • Loading branch information
WalterBright authored and 9rnsr committed Feb 15, 2014
1 parent a822cc5 commit 2ec67c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/attrib.c
Expand Up @@ -1707,6 +1707,9 @@ void UserAttributeDeclaration::semantic(Scope *sc)
//printf("UserAttributeDeclaration::semantic() %p\n", this);
if (decl)
{
if (!scope)
Dsymbol::setScope(sc); // for function local symbols

Scope *newsc = sc;
if (atts && atts->dim)
{
Expand Down
20 changes: 20 additions & 0 deletions test/runnable/uda.d
Expand Up @@ -328,6 +328,26 @@ alias X9741 = ShowAttributes!(B9741);

@A9741 struct B9741 {}

/************************************************/
// 12160

auto before12160(alias Hook)(string) { return 0; }

template checkUDAs12160(alias Func)
{
enum x = __traits(getAttributes, Func).length;
}

void test12160()
{
int foo() { return 42; } // OK <- NG

@before12160!foo("name1")
void bar(int name1, double name2) {}

alias X = checkUDAs12160!(bar);
}

/************************************************/
// 10208

Expand Down

0 comments on commit 2ec67c3

Please sign in to comment.