www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20700] New: Forward references leads to `extern(C++,

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

          Issue ID: 20700
           Summary: Forward references leads to `extern(C++,
                    class|struct)` being ignored
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: C++, industry
          Severity: major
          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++):
version(Bad) void before(const ref Foo);
extern(C++, class) struct Foo {}
void after(const ref Foo);

version(Bad) pragma(msg, "Before: ", before.mangleof);
pragma(msg, "After:  ", after.mangleof);
```

With no version, it outputs:
?after  YAXABVFoo   Z

Which is the correct mangling. However with `-version=Bad`:
```
Before: ?before  YAXABUFoo   Z
After:  ?after  YAXABUFoo   Z
```

--
Mar 26