https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88445
Bug ID: 88445 Summary: noexcept(expr) should return true with -fno-exceptions Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following example: #include <type_traits> struct test { test(); test(test&&); test& operator=(test&&); }; void test_func() { static_assert(noexcept(test{test()}), ""); static_assert(std::is_nothrow_move_constructible<test>::value, ""); static_assert(std::is_nothrow_move_assignable<test>::value, ""); } The static assertions fail with the -fno-exceptions flag however no exception could happen because all the exceptions are disabled. Please adjust the noexcept(expr) logic for the -fno-exceptions flag. Such adjustment is essential because the standard library heavily relies on the type traits and chooses the suboptimal algorithms in -fno-exceptions environments.