[clang] Correctly diagnose incomplete arrays with static storage in C (PR #134374)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 4 07:22:06 PDT 2025
================
@@ -3,16 +3,15 @@
-struct foo; // c-note 5 {{forward declaration of 'struct foo'}} \
+struct foo; // c-note 4 {{forward declaration of 'struct foo'}} \
cxx-note 3 {{forward declaration of 'foo'}}
void b; // expected-error {{variable has incomplete type 'void'}}
struct foo f; // c-error {{tentative definition has type 'struct foo' that is never completed}} \
cxx-error {{variable has incomplete type 'struct foo'}}
static void c; // expected-error {{variable has incomplete type 'void'}}
-static struct foo g; // c-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
----------------
AaronBallman wrote:
Because the diagnostic went from `ExtWarn` to `Extension` so it's no longer emitted by default. There's nothing dangerous about the tentative definition by itself, and we give other diagnostics in cases where it is an issue (`tentative definition has type 'struct foo' that is never completed` or `tentative array definition assumed to have one element`).
https://github.com/llvm/llvm-project/pull/134374
More information about the cfe-commits
mailing list