https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117785
--- Comment #31 from Jakub Jelinek <jakub at gcc dot gnu.org> --- what() is printed if derived from std::exception, constexpr, etc. E.g. /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:108:23: in 'constexpr' expansion of 'bar(1)' /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:82:1: error: 'std::terminate' called after throwing an exception of type 'S'; 'what()': 'this is S' /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:82:1: note: uncaught exception exited from 'noexcept' function 'constexpr int bar(int)' or /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:123:25: error: uncaught exception of type 'T'; 'what()': 'hello, world' Or it prints the content of the exception object, like: /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:110:23: in 'constexpr' expansion of 'bar(3)' /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:82:1: error: 'std::terminate' called after throwing an exception 'U{1, -2, 42}' /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:82:1: note: uncaught exception exited from 'noexcept' function 'constexpr int bar(int)' or /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh9.C:125:25: error: uncaught exception '42' Or as last fallback it prints just the type /usr/src/gcc/gcc/testsuite/g++.dg/cpp26/constexpr-eh12.C:71:49: error: uncaught exception of type 'E*' This was e.g. when E is a class with int * member initialized by new int, in that case printing the value is I think not what users want to see.