[Issue 17150] New: Add a trait to detect the linkage attribute of classes and interfaces

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 6 00:12:13 PST 2017


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

          Issue ID: 17150
           Summary: Add a trait to detect the linkage attribute of classes
                    and interfaces
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

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.

--


More information about the Digitalmars-d-bugs mailing list