[Issue 18429] alias this enum causes segmentation fault

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 13 14:07:34 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18429

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

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

--- Comment #1 from RazvanN <razvan.nitu1305 at 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

--


More information about the Digitalmars-d-bugs mailing list