[Issue 20700] New: Forward references leads to `extern(C++, class|struct)` being ignored

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 26 08:46:41 UTC 2020


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 at puremagic.com
          Reporter: pro.mathias.lang at 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
```

--


More information about the Digitalmars-d-bugs mailing list