Bug 24803 – __traits(location) is inconsistent with modules

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-10-10T09:32:15Z
Last change time
2024-10-10T12:21:49Z
Keywords
pull
Assigned to
No Owner
Creator
Dennis

Comments

Comment #0 by dkorpel — 2024-10-10T09:32:15Z
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); } ```
Comment #1 by dlang-bot — 2024-10-10T10:02:31Z
@dkorpel created dlang/dmd pull request #16983 "Fix bugzilla 24803 - __traits(location) is inconsistent with modules" fixing this issue: - Fix bugzilla 24803 - __traits(location) is inconsistent with modules https://github.com/dlang/dmd/pull/16983
Comment #2 by dlang-bot — 2024-10-10T12:21:49Z
dlang/dmd pull request #16983 "Fix bugzilla 24803 - __traits(location) is inconsistent with modules" was merged into master: - e3c83a4c09e7b6ec16bb95c6fb237c8b436f2349 by Dennis Korpel: Fix bugzilla 24803 - __traits(location) is inconsistent with modules https://github.com/dlang/dmd/pull/16983