Permalink
Browse files

fix test result for issue 6661

Inherently, when you try to instantiate a template, the whole template
body correctness should be checked at the same time.

In this case, bug6661!(int).qutz is a normal function declared inside
template, so it should be instantiated at the same time with bug6661!(int).
Now, the inner `static assert(qutz(13).sizeof!=299);` runs the semantic3
of qutz by calling it. So the module level static assertion fails _correctly_.

But, `is(typeof(bug6661x!(int)))` still returns true incorrectly.
I think it is yet another known issue in current dmd implementation.
  • Loading branch information...
1 parent 6a0be5b commit e9142862884625d0db801bbf1f05ad9487aae28b @9rnsr 9rnsr committed Jan 24, 2013
Showing with 12 additions and 1 deletion.
  1. +12 −1 test/compilable/compile1.d
View
13 test/compilable/compile1.d
@@ -93,7 +93,18 @@ template bug6661(Q)
const Q blaz = 6;
}
-static assert(is(typeof(bug6661!(int).blaz)));
+static assert(!is(typeof(bug6661!(int).blaz)));
+
+template bug6661x(Q)
+{
+ int qutz(Q y)
+ {
+ Q q = "abc";
+ return 67;
+ }
+}
+// should pass, but doesn't in current
+//static assert(!is(typeof(bug6661x!(int))));
/**************************************************
6599 ICE(constfold.c) or segfault

0 comments on commit e914286

Please sign in to comment.