https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104702
Bug ID: 104702
Summary: [12 Regression] False positive -Wunused-value warning
with -fno-exceptions
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dani at danielbertalan dot dev
Target Milestone: ---
I'm getting a false positive "value computed is not used" warning on trunk iff
I specify -fno-exceptions.
Godbolt link: https://godbolt.org/z/h7ssrza8Y
$ cat unused.cpp
struct FlyString {
FlyString(char const*);
~FlyString();
};
struct Array { FlyString __data[1]; };
void frobnicate(Array&);
int main() {
Array s_reserved_words { "" };
frobnicate(s_reserved_words);
}
$ g++ -fno-exceptions -Wunused-value unused.cpp
unused.cpp: In function 'int main()':
unused.cpp:11:33: warning: value computed is not used [-Wunused-value]
11 | Array s_reserved_words { "" };
| ^