-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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 analyzer
Description
This gives a warning:
struct A
{
[[deprecated]] int x = 42;
};
int main()
{
A a;
A b = a;
a = b;
}
<source>:1:8: warning: 'A::x' is deprecated [-Wdeprecated-declarations]
1 | struct A
| ^
<source>:3:24: note: declared here
3 | [[deprecated]] int x = 42;
| ^
<source>:1:8: warning: 'A::x' is deprecated [-Wdeprecated-declarations]
1 | struct A
| ^
<source>:3:24: note: declared here
3 | [[deprecated]] int x = 42;
| ^
<source>: In function 'int main()':
<source>:8:7: note: synthesized method 'constexpr A::A()' first required here
8 | A a;
| ^
IMO this isn't very useful. Only the manual uses of this field should warn, not the implicit ones.
GCC has the same issue, but MSVC doesn't. I've tested on Clang 20 and trunk.
leon-richardt
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 analyzer