Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1294 from 9rnsr/fix9018

Issue 9018 - __traits(compiles, ...) is true on second check for same incompilable code
  • Loading branch information...
commit f968f3c29d10d537d1f9f039151eed6df70d5fe5 2 parents 71a74fc + f60d923
@donc donc authored
Showing with 17 additions and 0 deletions.
  1. +1 −0  src/template.c
  2. +16 −0 test/runnable/template9.d
View
1  src/template.c
@@ -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);
View
16 test/runnable/template9.d
@@ -1582,6 +1582,22 @@ 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()
{
Please sign in to comment.
Something went wrong with that request. Please try again.