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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That makes me a little uncomfortable. Currently you can use something like:

struct X
{
#ifndef NDEBUG
  X(int) noexcept(false);
#endif

  //...
};

bool test(std::variant<int, X> const& v)
{
  return v.valueless_by_exception();
}

and it "works" (despite the ODR violation), even if the variant was put into a
valueless state in a TU where the throwing constructor was defined and the test
is in a TU where it isn't defined.

The suggested intrinsic would turn this from a "harmless" ODR violation to a
more problematic one.

Reply via email to