Bug 5796 – ICE with pragma(msg, ...) after missing ';' in a template
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-03-30T08:37:00Z
Last change time
2012-01-31T01:09:35Z
Keywords
ice-on-invalid-code
Assigned to
clugdbug
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-03-30T08:37:48Z
When a 'pragma(msg, ...)' pragma has a missing comma, the subsequent pragma(msg, ...) will result in a segfault.
------
template A(B) {
pragma(msg, B) // <-- missing ';'
enum A = 0;
}
enum a = A!int;
pragma(msg, 0);
------
The error exists at least since 2.042 http://ideone.com/MVgnG, and still persists in 2.052. The segfault is raised in 'ExpInitializer::semantic' in 'init.c':
Initializer *ExpInitializer::semantic(Scope *sc, Type *t)
{
//printf("....
exp = exp->semantic(sc);
exp = resolveProperties(sc, exp);
exp = exp->optimize(WANTvalue | WANTinterpret);
Type *tb = t->toBasetype(); // <-- this line
Comment #1 by github-bugzilla — 2012-01-30T23:22:18Z