Bug 23039 – importC: declaration with array length has itself in scope

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-19T13:43:52Z
Last change time
2022-05-05T21:04:16Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
duser
See also
https://issues.dlang.org/show_bug.cgi?id=23038

Comments

Comment #0 by duser — 2022-04-19T13:43:52Z
const int x = 1; void fn1() { char x[x]; } struct S1 { char x[x]; }; //void fn2() { typeof(x) x; } //struct S2 { typeof(x) x; }; these give circular reference errors in dmd but work in other compilers (except gcc doesn't like "struct S1" using the global) found when testing the typeof PR, it is also affected
Comment #1 by duser — 2022-04-22T04:33:48Z
also seen with function parameter types: typedef int y; void fn3() { void(*y)(y); } struct S3 { void(*y)(y); }; test.c(2): Error: circular reference to variable `y` test.c(3): Error: circular reference to variable `test.S3.y` these should use the typedef "y" but instead use the function pointer declaration itself
Comment #2 by duser — 2022-04-22T04:49:46Z
actually, the function one seems to have been fixed already, probably by https://github.com/dlang/dmd/pull/13990 (i was using dmd with that fix reverted because it caused issue 23030)
Comment #3 by bugzilla — 2022-04-23T04:01:53Z
The struct examples are part of https://issues.dlang.org/show_bug.cgi?id=23039
Comment #4 by bugzilla — 2022-04-23T04:02:18Z
Comment #5 by dlang-bot — 2022-04-23T04:02:56Z
@WalterBright created dlang/dmd pull request #14022 "fix Issue 23039 - importC: declaration with array length has itself i…" fixing this issue: - fix Issue 23039 - importC: declaration with array length has itself in scope https://github.com/dlang/dmd/pull/14022
Comment #6 by dlang-bot — 2022-04-25T14:33:36Z
dlang/dmd pull request #14022 "fix Issue 23039 - importC: declaration with array length has itself i…" was merged into stable: - 99bd95b28016e74f1f4ec3f0a152d149728d4b4c by Walter Bright: fix Issue 23039 - importC: declaration with array length has itself in scope https://github.com/dlang/dmd/pull/14022
Comment #7 by dlang-bot — 2022-05-05T21:04:16Z
dlang/dmd pull request #14064 "merge stable" was merged into master: - b484ae818eef439c8385261ff8313fc101270834 by Walter Bright: fix Issue 23039 - importC: declaration with array length has itself in scope (#14022) https://github.com/dlang/dmd/pull/14064