[Bug libstdc++/85517] std::variant exception safety problems
metaprogrammingtheworld at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 25 15:19:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85517
Matt Calabrese <metaprogrammingtheworld at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |metaprogrammingtheworld@gma
| |il.com
--- Comment #2 from Matt Calabrese <metaprogrammingtheworld at gmail dot com> ---
Example copy-assign non-compliance:
//////////
#include <variant>
struct bar
{
bar() noexcept = default;
bar(bar&&) { /*never throws, but not noexcept*/ }
bar(bar const&) // A copy constructor that throws.
{
throw 0;
}
bar& operator=(bar&&) noexcept = default;
bar& operator=(bar const&) noexcept = default;
};
int main()
{
std::variant<int, bar> v1, v2 = bar();
try
{
v1 = v2;
}
catch( int )
{
return 0;
}
return 1;
}
More information about the Gcc-bugs
mailing list