-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 23017 - C++ class may not derive from D class #13984
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#13984" |
| extern(C++) class CppChildB : CppClass {} | ||
|
|
||
| extern(D) class DChildA : DClass {} // error | ||
| extern(D) class DChildB : CppClass {} // automatically made extern(C++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what effect does extern(D) have here? mangling? or is this just for convenience?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just being explicit. Apparently, extern(D) and nothing/default is treated identically, which surprised me: even when explicitly marked extern(D), it can actually result in extern(C++) class kind and mangling, but it's how it is.
| * Returns: | ||
| * 0-terminated string for `c` | ||
| */ | ||
| const(char)* toChars(ClassKind c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we already have a similar function that works on a linkage, not on a ClassKind: https://github.com/dlang/dmd/blob/master/src/dmd/hdrgen.d#L2967
We most likely don't need both, so I suggest finding a way to merge the 2 concepts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's this PR's responsibility to merge the ClassKind and LINK concepts, if that's even a good idea in the first place. (I only use extern(C) and extern(D) myself so I'm not sure)
No description provided.