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.

Reply via email to