Bug 10599 – CTFE: assert failure interpret.c 310

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-10T12:00:00Z
Last change time
2013-07-12T11:45:02Z
Keywords
CTFE
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2013-07-10T12:00:26Z
The following: ---------------------------- struct Bug { int val = 3.45; } int bug() { Bug p = Bug(); return 1; } static assert(bug()); ----------------------------- causes: ice.d(4): Error: cannot implicitly convert expression (3.45) of type double to int CTFE: ErrorExp in ice.d(6) assert interpret.c(310) 0
Comment #1 by bugzilla — 2013-07-10T12:03:58Z
Comment #2 by clugdbug — 2013-07-10T23:41:27Z
This is an error propagation bug that the CTFE AST validator is detecting. The "implicit conversion" error message occurs when running semantic on Bug(). Later on, when compiling bug(), no new error message is generated, even though it uses the ErrorExp from the default initializer of Bug(). So, bug() isn't marked as containing an error.
Comment #3 by github-bugzilla — 2013-07-12T11:44:35Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8a9421b4d1e8b577a412a40bce0979a17a63a9c8 Fix bug 10599 CTFE assert with bad struct initializer This is an ErrorExp propagation/gagging bug. Errors in struct initializers don't generate error messages when used, but still need to report an error to the enclosing function.