Debian Codegraph @

clang/test/Sema/c23-decl-in-prototype.c

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c23 -Wvisibility %s
3
4 // In C23 mode, we only want to diagnose a declaration in a prototype if that
5 // declaration is for an incomplete tag type. Otherwise, we silence the
6 // diagnostic because the function could be called with a compatible type.
7
8 void f(struct Incomplete); // expected-warning {{will not be visible outside of this function}}
9 void g(struct Complete { int x; });
10
11 struct A {
12 struct B {
13 int j; // #j
14 } b;
15 };
16
17 void complicated(struct A { struct B { int j; } b; }); // Okay
18
19 void also_complicated(struct A { struct B { int glorx; } b; }); // expected-error {{type 'struct B' has incompatible definitions}} \
20 expected-note {{field has name 'glorx' here}} \
21 expected-note@#j {{field has name 'j' here}}