[Issue 15879] New: Compiler crashes when two template structs have the same name

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 5 12:13:55 PDT 2016


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

          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 at puremagic.com
          Reporter: andy.pj.hanson at 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:

app.d:

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

otheroption.d:
    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`.

--


More information about the Digitalmars-d-bugs mailing list