Bug 17150 – Add a trait to detect the linkage attribute of classes and interfaces
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-02-06T08:12:13Z
Last change time
2017-11-03T18:44:08Z
Assigned to
No Owner
Creator
Basile B.
Comments
Comment #0 by b2.temp — 2017-02-06T08:12:13Z
Currently extern(C++) interfaces and extern(C++) classes can only be dinstinguished using compile time introspection on the member functions (with std.traits.functionLinkage that detects the linkage in the function mangle)
However this kind of introspection is heavy and bug prone (the recurring issue about protection attribute in __trait(getMember/getOverload)
Two examples of where it would be usefull to have __trait(linkage)
- std.traits.BaseClassesTuple: it only works with D classes so we could filter the call.
- std.experimental.allocators.allocator.dispose: the overload that takes interfaces should not work for C++ interfaces.
Comment #1 by b2.temp — 2017-11-03T18:44:08Z
*** This issue has been marked as a duplicate of issue 17419 ***