-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party
Description
struct A
{
int a;
};
A a{
.a = 10,
.a = 20,
};
This correctly errors with -std=c++20 -pedantic-errors
:
<source>:8:10: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
8 | .a = 20,
| ^~
<source>:7:10: note: previous initialization is here
7 | .a = 10,
| ^~
But if I use -std=c++20 -pedantic-errors -Wextra
, this instead becomes a warning:
<source>:8:10: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
8 | .a = 20,
| ^~
<source>:7:10: note: previous initialization is here
7 | .a = 10,
| ^~
I get the same warning if I use just -std=c++20
.
The correct behavior is for this to be an error if -pedantic-errors
is present, regardless of -Wextra
.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second partyVerified by a second party