[Bug c++/97566] [[no_unique_address]] causes miscompiles when mixed with EBO in constexpr context

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 29 16:34:32 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97566

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-10-29
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I particularly like that you can do this and it compiles and runs OK:

  assert(test() == 1);        // works, unless optimisations enabled
  static_assert(test() == 0);


Or to make it always run OK:

#ifdef __OPTIMIZE__
  assert(test() == 0);
#else
  assert(test() == 1);
#endif
  static_assert(test() == 0);


More information about the Gcc-bugs mailing list