https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106922
--- Comment #10 from Jan Žižka <jan.zizka at nokia dot com> --- Created attachment 53581 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53581&action=edit Second reproducer failing with 5edf02ed2b6de024f83a023d046a6a18f645bc83 I have cherry-picked the fix on top of gcc 12 and I confirm that my original reproducer passes. But our production code still fails. I have created new reproducer, the change is that the optional is inside a struct and seems there need to be two elements. With first reproducer I have eliminated this additional struct as that was also failing. Please try with: g++ -Werror -std=c++20 -O2 -Wall -o reproduce1.o -c reproduce1.cpp