Thread overview
[Issue 18429] alias this enum causes segmentation fault
Feb 13, 2018
RazvanN
February 13, 2018
https://issues.dlang.org/show_bug.cgi?id=18429

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
(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

--
February 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18429

--- Comment #2 from github-bugzilla@puremagic.com ---
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 <JinShil@users.noreply.github.com>

--
February 14, 2018
https://issues.dlang.org/show_bug.cgi?id=18429

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--