Thread overview |
---|
August 22, 2008 [Issue 2303] New: static assert in a template function is not reported | ||||
---|---|---|---|---|
| ||||
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. -- |
August 22, 2008 [Issue 2303] static assert in a template function is not reported | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2303 ------- Comment #1 from samukha@voliacable.com 2008-08-22 03:01 ------- 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. -- |
August 26, 2008 [Issue 2303] static assert in a template function is not reported | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2303 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME ------- Comment #2 from bugzilla@digitalmars.com 2008-08-26 03:44 ------- 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. -- |
August 26, 2008 [Issue 2303] static assert in a template function is not reported | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2303 ------- Comment #3 from samukha@voliacable.com 2008-08-26 08:14 ------- My apologies. This bug disappeared at some point after dmd 2.015 -- |
Copyright © 1999-2021 by the D Language Foundation