| Issue |
202326
|
| Summary |
-Wunused-variable incorrectly triggering on self-init
|
| Labels |
clang:diagnostics,
false-positive
|
| Assignees |
|
| Reporter |
AaronBallman
|
Consider the following example:
```
struct [[gnu::warn_unused]] S {
};
void func() {
struct S s1 = s1;
}
```
Language | Clang | GCC
---| --- | ---
C | No diagnostic | No diagnostic
C++ | Diagnostic | No diagnostic
https://godbolt.org/z/nafGTonor
I believe Clang's diagnostic in C++ is a false positive; mentioning the variable in its own initialization should silence the diagnostic because the variable is being used.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs