[Issue 17972] New: __traits(getLinkage) doesn't work for classes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 7 13:15:41 UTC 2017


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

          Issue ID: 17972
           Summary: __traits(getLinkage) doesn't work for classes
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: doob at me.com

I'm not sure if this should be considered a bug or an enhancement request. I
think that __traits(getLinkage) should work for classes, structs and
interfaces. This is useful to identify a C++ class/struct or an Objective-C
interface. Technically the class might not have a linkage but since one usually
put the linkage on a class I think it make sense to be able to get the linkage
from a class.

>From an implementation point of view, it looks like the original implementation
[1] assumed that all declarations inherit from the Declaration class, but this
is not the case for structs, classes and interfaces.

[1] https://github.com/dlang/dmd/pull/6822

--


More information about the Digitalmars-d-bugs mailing list