Skip to content

Commit

Permalink
Merge pull request #4001 from 9rnsr/fix13481
Browse files Browse the repository at this point in the history
Issue 13481 - bug with inferring attributes from built-in properties
  • Loading branch information
WalterBright committed Sep 18, 2014
2 parents 3d53260 + 1ac9063 commit add92c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/expression.c
Expand Up @@ -5290,11 +5290,17 @@ Expression *FuncExp::syntaxCopy()
fd2 = (*td2->members)[0]->isFuncLiteralDeclaration();
assert(fd2);
}
else
else if (fd->semanticRun == PASSinit)
{
td2 = NULL;
fd2 = (FuncLiteralDeclaration *)fd->syntaxCopy(NULL);
}
else
{
// Bugzilla 13481: Prevent multiple semantic analysis of lambda body.
td2 = NULL;
fd2 = fd;
}
return new FuncExp(loc, fd2, td2);
}

Expand Down
16 changes: 16 additions & 0 deletions test/compilable/compile1.d
Expand Up @@ -708,3 +708,19 @@ final class C12703
{
S12703 s = S12703(1);
}

/***************************************************/
// 13481

mixin template Mix13481(void function() callback)
{
static this()
{
callback();
}
}

void sort13481() { int[] arr; arr.sort; }
mixin Mix13481!(&sort13481);

mixin Mix13481!({ int[] arr; arr.sort; });

0 comments on commit add92c6

Please sign in to comment.