www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15879] New: Compiler crashes when two template structs have


          Issue ID: 15879
           Summary: Compiler crashes when two template structs have the
                    same name
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andy.pj.hanson gmail.com

The crash happens when an imported template struct has the same name as one in
the current module.

It takes to modules to reproduce:


    import otheroption : Option;
    void main() { opt(1); }
    struct Option(T) {}
    Option!T opt(T)(T value) { return Option(); }

    struct Option(T) if(is(T == class)) {}

With these two files in the same directory, `dmd app.d` segfaults.

The error goes away if `if(is(T == class))` is removed in `otheroption.d`.

Apr 05 2016