Bug 7568 – pragma(msg) segfaults with an aggregate including a class.

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-23T11:02:00Z
Last change time
2012-02-29T23:35:20Z
Keywords
CTFE, ice
Assigned to
nobody
Creator
kennytm

Comments

Comment #0 by kennytm — 2012-02-23T11:02:13Z
Test cases: ----------------------------------------------- class C7568 {} struct S7568 { C7568 c; } auto test7568a() { return [new C7568]; } auto test7568b() { return S7568(new C7568); } pragma(msg, test7568a()); pragma(msg, test7568b()); ----------------------------------------------- This will cause a segmentation fault: test.d(4): Error: C7568 class literals cannot be returned from CTFE Segmentation fault This happens because an Expression* is assigned to the value 0x1, and the function 'argsToCBuffer' is trying to access the expression without first checking if the expression is a valid pointer. The program should simply fail to compile, without the segfault.
Comment #1 by bugzilla — 2012-02-29T19:15:25Z
Comment #2 by github-bugzilla — 2012-02-29T23:35:04Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8fadb858512dda3f2c697a6b55bb5d2369c18995 fix Issue 7568 - pragma(msg) segfaults with an aggregate including a class.