http://d.puremagic.com/issues/show_bug.cgi?id=6732
Summary: static assert fails on true expression Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: major Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: andrej.mitrov...@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-09-26 09:14:17 PDT --- template isDouble(T) { enum bool isDouble = __traits(hasMember, T, "x") || is(T == double); } void test(T)(T rhs) if (is(T == int)) { } void test(T)(T rhs) if (isDouble!T) { } void main() { static assert(__traits(compiles, test(4.5))); // fail test(4.5); // fine } If you comment out the static assert you'll see that the test() call compiles. Oddly enough if you swap the order of the calls like so: void main() { test(4.5); static assert(__traits(compiles, test(4.5))); } Then it works again. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------