The structure of these functions likely dates from the time before G++ fully supported C++14 extended constexpr, so that the throw expression had to be the operand of a conditional expression. That is not true now, so we can use a more straightforward version of the code. We can also simplify the declaration of __throw_bad_optional_access by using the C++11-style [[noreturn]] attribute so that a separate declaration isn't needed. libstdc++-v3/ChangeLog: * include/experimental/optional (__throw_bad_optional_access): Replace GNU attribute with C++11 attribute. (optional::value, optional::value_or): Use if statements instead of conditional expressions. * include/std/optional (__throw_bad_optional_access) (optional::value, optional::value_or): Likewise. Tested powerpc64le-linux. Committed to trunk.