[Bug c++/86465] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
proski at gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Sep 30 18:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86465
--- Comment #3 from Pavel Roskin <proski at gnu dot org> ---
Created attachment 44770
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44770&action=edit
Futher reduced example
I was able to reduce the example to just 55 lines, removing almost all the code
that came from the standard headers. The code complies with C++ standards all
the way back to C++03.
As I suspected, the implementation of std::optional in libstdc++ uses a trick
to avoid initializing the payload when the optional value default initialized,
and that code turns out to be essential for reproducing the issue.
Try uncommenting _empty_char, and the warning goes away.
More information about the Gcc-bugs
mailing list