digitalmars.D.bugs - [Issue 2303] New: static assert in a template function is not reported
- d-bugmail puremagic.com (35/35) Aug 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2303
- d-bugmail puremagic.com (23/23) Aug 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2303
- d-bugmail puremagic.com (12/12) Aug 26 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2303
- d-bugmail puremagic.com (4/4) Aug 26 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2303
http://d.puremagic.com/issues/show_bug.cgi?id=2303 Summary: static assert in a template function is not reported Product: D Version: 2.018 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: samukha voliacable.com I wasn't able to reduce this further. Must be related to 2227 T foo(T : S!(U), U)(invariant(U) u) { T s; bar!(T)(s, u); return s; } void bar(T : S!(U), U)(T s, invariant(U) u) { static assert(false, "Error!"); // compiles if this line is commented out } void main() { foo!(S!(int))(1); } ---- : template Test.bar(T) does not match any function template declaration : template Test.bar(T) cannot deduce template function from argument types !(S!(int))(S!(int),invariant(int)) : template instance Test.foo!(S!(int),int) error instantiating This should report the static assert message, preferably with template instantiation trace. --
Aug 22 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2303 A corrected example: ---- struct S(T) { } void foo(T : S!(U), U)(invariant(U) u) { T s; bar!(T)(s, u); } void bar(T : S!(U), U)(T s, invariant(U) u) { static assert(false, "Error!"); } void main() { foo!(S!(int))(1); } ---- Works as expected if invariant type modifiers are omitted. --
Aug 22 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2303 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME The second, corrected example produces the following when compiled with 2.018, both with and without the invariant type modifiers: test.d(13): static assert "Error!" which appears to be correct. --
Aug 26 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2303 My apologies. This bug disappeared at some point after dmd 2.015 --
Aug 26 2008