Hi Florian, > > clang (at least in version >= 4), in C++ mode, supports the 'throw > > ()' declaration on functions, and uses it to optimize try/catch > > statements at the caller site. > > I think throw() has been removed from C++20: > > <http://eel.is/c++draft/except.spec> > <https://en.cppreference.com/w/cpp/language/except_spec> > > So it will soon break again.
Thanks for the heads-up. But g++ 10.2.0 still understands this "removed" syntax: ==================== nothrow.cc ==================== extern int validate (int x) throw (); extern void err (int e); int foo (int x, int y) { try { validate (x); } catch (int e) { err (e); } try { validate (y); } catch (int e) { err (e); } return x + y; } ==================================================== $ g++ -O2 -S -std=c++20 -Wall nothrow.cc <no error, no warning> And glibc/misc/sys/cdefs.h has not been updated yet. Is it certain that GCC and the GCC compatible compilers (clang, icc, etc.) will continue to support 'throw ()'? Bruno