Bug 18429 – alias this enum causes segmentation fault

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-13T00:33:57Z
Last change time
2018-02-14T11:56:03Z
Assigned to
No Owner
Creator
Ali Cehreli

Comments

Comment #0 by acehreli — 2018-02-13T00:33:57Z
struct S { alias a this; enum a = 1; } $ dmd deneme.d -c Segmentation fault Interestingly, when the lines inside struct S are swapped then it compiles fine. Ali
Comment #1 by razvan.nitu1305 — 2018-02-13T14:07:34Z
(In reply to Ali Cehreli from comment #0) > struct S { > alias a this; > enum a = 1; > } > > $ dmd deneme.d -c > Segmentation fault > > Interestingly, when the lines inside struct S are swapped then it compiles > fine. > > Ali This happens with declarations for which the type must be deduced. Note that replacing enum with auto results in segmentation fault (or assert error on my machine - you probably do not have the latest version of dmd). That is due to the fact that when semantic is performed an the alias this AST node, the type of the enum variable is not known. Calling semantic on the symbol fixes the issue. PR: https://github.com/dlang/dmd/pull/7888
Comment #2 by github-bugzilla — 2018-02-14T11:56:02Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/df08cb6c83ec29425343d734fb00b0d33f3fd92d Fix Issue 18429 - alias this enum causes segmentation fault https://github.com/dlang/dmd/commit/5cc4309525c7f36ebeb260dcadc90d263df4b1de Merge pull request #7888 from RazvanN7/Issue_18429 Fix Issue 18429 - alias this enum causes segmentation fault merged-on-behalf-of: Mike Franklin <[email protected]>