https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90295
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Mathias Stearn from comment #2) > Example showing significant codegen at -O3 which should all optimize away: > > #include <exception> > bool test() { > std::exception_ptr p1; > std::exception_ptr p2 (p1); > p1 = p2; > swap(p1, p2); > return p1 == nullptr && nullptr == p2 && p1 == p2; > } This optimizes to nothing now. Fixed for GCC 11, and not plausible to backport.