Bug 14803 – successful static assert can change result of compilation

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-17T15:05:14Z
Last change time
2024-12-13T18:43:47Z
Assigned to
No Owner
Creator
Rainer Schuetze
Moved to GitHub: dmd#19016 →

Comments

Comment #0 by r.sagitario — 2015-07-17T15:05:14Z
This compiles successfully: enum hasElaborateAssign(T) = is(typeof(foo!T())) || true; //static assert(hasElaborateAssign!int); static assert(is(typeof(foo!int()))); void foo(T)() { static assert(hasElaborateAssign!T); } but when uncommenting the first assertion, the second assert fails with error test.d(5): Error: static assert (is(typeof(__error))) is false
Comment #1 by dlang-bugzilla — 2015-09-01T05:44:26Z
This appears to be a regression. Introduced by https://github.com/D-Programming-Language/dmd/pull/544
Comment #2 by k.hara.pg — 2015-09-01T12:53:36Z
This is a problem in the implementation of instance cache. None of old versions did support it. (In reply to Vladimir Panteleev from comment #1) > This appears to be a regression. > > Introduced by https://github.com/D-Programming-Language/dmd/pull/544 No, before that PR, there's no attribute inference for template functions, so foo!T() didn't see the hasElaborateAssign!T instantiation in its body. Change to major.
Comment #3 by robert.schadek — 2024-12-13T18:43:47Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19016 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB