Skip to content

Commit e049ce7

Browse files
authored
fix Issue 23697 - No examples of invalid forward references in C code accepted by ImportC (#3624)
1 parent 97a42c5 commit e049ce7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/importc.dd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,19 @@ int myprintf(char *, ...) asm("printf");
423423
$(P Any declarations in scope can be accessed, not just
424424
declarations that lexically precede a reference.)
425425

426+
$(CCODE
427+
Ta *p; // Ta is forward referenced
428+
struct Sa { int x; };
429+
typedef struct Sa Ta; // Ta is defined
430+
)
431+
432+
$(CCODE
433+
struct S s;
434+
int* p = &s.t.x; // struct S definition is forward referenced
435+
struct S { int a; struct T t; }; // T still forward referenced
436+
struct T { int b; int x; }; // definition of struct T
437+
)
438+
426439
$(H3 $(LNAME2 cpp-tag-symbols, C++ Style Tag Symbols))
427440

428441
$(P In C++, `struct`, `union` or `enum` tag symbols can be accessed without needing

0 commit comments

Comments
 (0)