Bug 23720 – runnable/test22513.c:16:12: error: invalid use of undefined type ‘struct S’

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2023-02-15T17:52:11Z
Last change time
2023-02-20T12:37:09Z
Keywords
accepts-invalid, ImportC
Assigned to
No Owner
Creator
Iain Buclaw
Depends on
23689
See also
https://issues.dlang.org/show_bug.cgi?id=23689

Comments

Comment #0 by ibuclaw — 2023-02-15T17:52:11Z
When compiling the test with `gcc -std=c11 -fsyntax-only` runnable/test22513.c:16:12: error: invalid use of undefined type ‘struct S’ 16 | int* p = &s.t.x; | ^ Original test: ``` struct S s; int* p = &s.t.x; struct S { int a; struct T t; }; ```
Comment #1 by bugzilla — 2023-02-20T07:29:52Z
ImportC allows forward references as an extension.
Comment #2 by ibuclaw — 2023-02-20T12:35:59Z
(In reply to Walter Bright from comment #1) > ImportC allows forward references as an extension. Then it would be good to have it as another example for https://dlang.org/spec/importc.html#forward-references
Comment #3 by ibuclaw — 2023-02-20T12:37:09Z
*** This issue has been marked as a duplicate of issue 23697 ***