[clang] [C] Add -Wtentative-definition-compat (PR #137967)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 13 05:07:51 PDT 2025


asmok-g wrote:

@AaronBallman Is it meant that the following fires the warning, because it doesn't look wrong to me:
```
struct X{};
extern const struct X x;
const struct X x = {};
```

[Here](https://en.cppreference.com/w/c/language/extern) I see:
```
Tentative definitions
A tentative definition is an external declaration without an initializer, and either without a [storage-class specifier](https://en.cppreference.com/w/c/language/storage_duration) or with the specifier static.

A tentative definition is a declaration that may or may not act as a definition. If an actual external definition is found earlier or later in the same translation unit, then the tentative definition just acts as a declaration.
```

Sorry if this is actually a naive question.

https://github.com/llvm/llvm-project/pull/137967


More information about the cfe-commits mailing list