5796 – ICE with pragma(msg, ...) after missing ';' in a template

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5796 - ICE with pragma(msg, ...) after missing ';' in a template
Summary: ICE with pragma(msg, ...) after missing ';' in a template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: Don
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
Reported: 2011年03月30日 08:37 UTC by kennytm
Modified: 2012年01月31日 01:09 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description kennytm 2011年03月30日 08:37:48 UTC
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 github-bugzilla 2012年01月30日 23:22:18 UTC
Commit pushed to master at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/ac69d4b9893725d0eb7f40002f73d0b280214b02
Merge pull request #665 from donc/ice5796
ICE bugs 5796 and 6720
Comment 2 github-bugzilla 2012年01月31日 01:08:59 UTC
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/06b3b85c8f4e069d8a9a6224d155047ba83413c9
fix Issue 5796 - ICE with pragma(msg, ...) after missing ';' in a template


AltStyle によって変換されたページ (->オリジナル) /