D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17152 - DMD segfaults because of struct with static const struct members
Summary: DMD segfaults because of struct with static const struct members
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Mac OS X
: P1 major
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2017-02-07 17:27 UTC by Sophie
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sophie 2017-02-07 17:27:03 UTC
DMD 2.072.0 crashes when compiling this program:

    struct Test{
        static const A = Test([1, 2, 3]);
        static const B = Test([4, 5, 6]);
        int[] x;
    }
    void main(){}

> dmd test.d
Segmentation fault: 11

Changing from const to immutable does not affect the error.

It works fine if one of the static const members are removed. It works fine if the members are static enum instead of static const.
Comment 1 Sophie 2017-02-07 18:39:29 UTC
Apparently this issue is fixed in master, will close the issue as soon as I'm able to confirm
Comment 2 basile-z 2019-11-05 22:06:00 UTC
all platforms were affected, confirmed to be fixed using run.dalng.io:


Up to      2.071.2: Success and no output
2.072.2 to 2.073.2: Segfault and no output
Since      2.074.1: Success and no output