https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122817
Bug ID: 122817
Summary: d: Root modules have no file location set
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gcc dot gnu.org
Target Milestone: ---
Seen with "conflicts with import at" diagnostics.
```
struct object {}
```
With gdc-14, error printed is
---
fail.d:1:1: error: struct ‘fail.object’ conflicts with import ‘fail.object’ at
fail.d
1 | struct object {}
| ^
---
With gdc-20250624
---
fail.d:1:1: error: struct ‘fail.object’ conflicts with import ‘fail.object’ at
1 | struct object {}
| ^
---
Module AST objects created by the entrypoint function to the D compiler don't
get a location set after Module::create(). It would seem that this is now
expected by the interfacing "backend" since
https://github.com/dlang/dmd/pull/16983
This would mean gdc-15 is affected as well.
Fix would be to assign a location immediately after Module::create
```
Module *m = Module::create (in_fnames[i], ...);
m->loc = Loc::singleFilename (in_fnames[i]);
modules.push (m);
```