www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20701] New: extern(C++, class|struct) should not apply to

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

          Issue ID: 20701
           Summary: extern(C++, class|struct) should not apply to inner
                    types
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

Consider the following code, compiled with DMD 2.091.0 on Windows x64:
```
extern(C++):
extern(C++, class) struct Container
{
    struct Inner
    {
        int val;
    }
}
void foo (const ref Container.Inner);
pragma(msg, foo.mangleof);
```

This will output: `?foo  YAXABVInner Container   Z` which demangles to `void
__cdecl foo(class Container::Inner const &)`.
However, `Inner` is not a class, it is a `struct`, and having a similar
declaration in C++ will lead to mangling errors.

--
Mar 26 2020