[Issue 24803] New: __traits(location) is inconsistent with modules

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 10 09:32:15 UTC 2024


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

          Issue ID: 24803
           Summary: __traits(location) is inconsistent with modules
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

It's not allowed for modules listed on the command line, but for imported
modules it returns the filename of the module it's called from.

```
import core.stdc.stdio;

void main()
{
// Error: can only get the location of a symbol, not `onlineapp`
    __traits(getLocation, __traits(parent, main));
// Error: `AliasSeq!("onlineapp.d", 1, 8)` has no effect
    __traits(getLocation, core.stdc.stdio);
}
```

--


More information about the Digitalmars-d-bugs mailing list