https://bugs.llvm.org/show_bug.cgi?id=45170
Bug ID: 45170
Summary: -Wdeprecated-declarations warns about "usage" with
uniform initialization
Product: clang
Version: 9.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
This code:
```
struct S {
int a;
__attribute__((deprecated)) int b;
int c;
};
S f() {
return S{1, 2, 3};
}
```
triggers this warning with Fedora's clang-9.0.1:
```
% clang++ -c deprecated_member.cxx
-
deprecated_member.cxx:8:17: warning: 'b' is deprecated
[-Wdeprecated-declarations]
return S{1, 2, 3};
^
deprecated_member.cxx:3:20: note: 'b' has been explicitly marked deprecated
here
__attribute__((deprecated)) int b;
^
deprecated_member.cxx:1:8: warning: 'b' is deprecated
[-Wdeprecated-declarations]
struct S {
^
deprecated_member.cxx:8:12: note: in implicit move constructor for 'S' first
required here
return S{1, 2, 3};
^
deprecated_member.cxx:3:20: note: 'b' has been explicitly marked deprecated
here
__attribute__((deprecated)) int b;
^
2 warnings generated.
```
This is a false positive because, due to the lack of designated initializers,
in order to initialize `c` here, I *must* initialize `b`. The warning should
only show up on the explicit use of `b`, not on its presence in the
initialization list. This also happens with `S s = {1, 2, 3};`.
Real world code is hitting this with the PyObject's deprecated `tp_print`
member in Python 3.9.
May be related to Bug #25472?
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs