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

          Issue ID: 24547
           Summary: Stack overflow in CppMangleVisitor.writeQualified
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: tim.dl...@t-online.de

DMD crashes when compiling the following code:

```
extern(C++):

struct S(bool defined)
{
    enum DefinedType { Defined }
}

void f(T)(S!(true).DefinedType = S!(true).DefinedType.Defined)
{
}

void main()
{
    f!(int)();
}
```

A gdb backtrace repeats the following three lines:
```
#50 0x0000555555952ab7 in CppMangleVisitor::visit(TemplateInstance*)
(this=0x7fffffffb848, t=0x7ffff789a8a0) at src/dmd/cppmangle.d:2095
#51 0x00005555559d6f8e in TemplateInstance::accept(Visitor*)
(this=0x7ffff789a8a0, v=0x7fffffffb848) at src/dmd/dtemplate.d:5496
#52 0x0000555555951b67 in
_D3dmd9cppmangle16CppMangleVisitor14writeQualifiedMFCQBz9dtemplate16TemplateInstanceMDFZvZv
(this=0x7fffffffb848, dg=..., t=0x7ffff789a8a0) at src/dmd/cppmangle.d:1671
```

According to run.dlang.org it compiled until 2.083.1 and DMD crashes since
2.084.1, but I did not check if the mangling was correct, when it compiled.

--

Reply via email to