Skip to content

Commit

Permalink
fix Issue 9018 - __traits(compiles, ...) is true on second check for …
Browse files Browse the repository at this point in the history
…same incompilable code
  • Loading branch information
9rnsr committed Nov 15, 2012
1 parent 2f2b2a1 commit f60d923
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/template.c
Expand Up @@ -5030,6 +5030,7 @@ void TemplateInstance::semantic(Scope *sc, Expressions *fargs)
//printf("isnested = %d, sc->parent = %s\n", isnested, sc->parent->toChars());
sc2->parent = /*isnested ? sc->parent :*/ this;
sc2->tinst = this;
sc2->speculative = speculative;

tryExpandMembers(sc2);

Expand Down
16 changes: 16 additions & 0 deletions test/runnable/template9.d
Expand Up @@ -1581,6 +1581,22 @@ struct A8990(T) { T t; }
struct B8990(T) { A8990!T* a; }
struct C8990 { B8990!C8990* b; }

/**********************************/
// 9018

template Inst9018(alias Template, T)
{
alias Template!T Inst;
}

template Template9018(T)
{
enum Template9018 = T;
}

static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert passes
static assert(!__traits(compiles, Inst9018!(Template9018, int))); // Assert fails

/**********************************/

int main()
Expand Down

0 comments on commit f60d923

Please sign in to comment.