www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24547] New: Stack overflow in CppMangleVisitor.writeQualified

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: nobody puremagic.com
          Reporter: tim.dlang 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:
```

(this=0x7fffffffb848, t=0x7ffff789a8a0) at src/dmd/cppmangle.d:2095

(this=0x7ffff789a8a0, v=0x7fffffffb848) at src/dmd/dtemplate.d:5496

_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.

--
May 10