[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

antoshkka at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 8 07:41:00 GMT 2018


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

--- Comment #8 from Antony Polukhin <antoshkka at gmail dot com> ---
Here's an idea:

Make valueless_by_exception() always false if all the alternatives are
trivially copyable. Implement copying and constructions/emplace for such
variants as a construction of a temporary + memcpy to destination. In theory
the compiler should eliminate the unnecessary copy.


More information about the Gcc-bugs mailing list