www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18705] New: dmd segmentation fault with duplicate class

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

          Issue ID: 18705
           Summary: dmd segmentation fault with duplicate class definition
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: test1 wannabephoenix.de

dlang forum:
https://forum.dlang.org/post/qlmvefrlyykojtczecib forum.dlang.org

snippet
https://run.dlang.io/is/OySBGO

the provoking line is commented out in that snippet. when commented in, all
compilers give the segfault, including ldc ones. except for 'all dmd
compilers..' with version <= 2.066.0

post by LiNbO3 might give more details
 
 There are a couple of bugs here:
 
 ---
 void main()
 {
     { class C { } }
     class C { }
     // C x; x.x=1;
     // static assert (!__traits(compiles, C.x));
 }
 ---
 
 The first bug can be shown by de-commenting the first line and can be easily
solved by modifying hdrgen.d by adding a check on t.sym.parent being non-null
to the visit(TypeClass) method.
 Once that's fixed de-comment the second line to have the compiler crash and
burn somewhere else.
--
Apr 02 2018