Bug 21219 – Invalid C++ header generated for extern(C++, [class|struct])

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-03T22:52:43Z
Last change time
2020-09-04T06:09:07Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2020-09-03T22:52:43Z
Example: =============================================== extern(C++, class) struct ClassFromStruct {} extern(C++, class) class ClassFromClass {} extern(C++, struct) struct StructFromStruct {} extern(C++, struct) class StructFromClass {} =============================================== dmd -c -o- -HC missing_class.d =============================================== // Automatically generated by Digital Mars D Compiler v2092 #pragma once #include <stddef.h> #include <stdint.h> // ignoring non-cpp struct ClassFromStruct because of linkage class ClassFromClass { public: }; // ignoring non-cpp struct StructFromStruct because of linkage class StructFromClass { public: }; =============================================== There are mutliple issues here: - ClassFromStruct and StructFromStruct are missing - StructFromClass is declared as class.
Comment #1 by dlang-bot — 2020-09-03T23:14:15Z
@MoonlightSentinel created dlang/dmd pull request #11681 "Fix 21219 - Invalid C++ header generated for extern(C++, [class|struct])" fixing this issue: - Fix 21219 - Invalid C++ header generated for extern(C++, [class|struct]) Fixed in three steps: - recognize that `extern(C++, [class|struct])` means `extern(C++)` - select the right identifier based on the `CPPMANGLE` - add `public:` if required by `CPPMANGLE`, not the AST type https://github.com/dlang/dmd/pull/11681
Comment #2 by dlang-bot — 2020-09-04T06:09:07Z
dlang/dmd pull request #11681 "Fix 21219 - Invalid C++ header generated for extern(C++, [class|struct])" was merged into master: - 0cce92d5116d5156344faeb64ecdffb405fad493 by MoonlightSentinel: Fix 21219 - Invalid C++ header generated for extern(C++, [class|struct]) Fixed in three steps: - recognize that `extern(C++, [class|struct])` means `extern(C++)` - select the right identifier based on the `CPPMANGLE` - add `public:` if required by `CPPMANGLE`, not the AST type https://github.com/dlang/dmd/pull/11681