On Thu, Apr 27, 2023 at 11:09:19AM +0200, Helmut Zeisel via Gcc wrote: > I compiled GCC 13.1.0 with GCC 12 and had the environment variable CXXFLAGS > set to -std=c++20 > This gives the error (both linux and cygin) > > gcc-13.1.0/libstdc++-v3/src/c++98/bitmap_allocator.cc:51:23: error: ISO C++17 > does not allow dynamic exception specifications > 51 | _M_get(size_t __sz) throw(std::bad_alloc) > > After > > unset CXXFLAGS > > compilation works
Don't do it. libstdc++ carefully decides which parts of it should be compiled by which C++ standard version. By forcing it to use something it wasn't designed to work with you are breaking its assumptions. Obviously c++98 code can use C++98 features... Jakub