`static constexpr` function called in a constant expression is…an error?

As T.C. demonstrated with some links in a comment, the standard is not quite clear on this; a similar problem arises with trailing return types using decltype(memberfunction()). The central problem is that class members are generally not considered to be declared until after the class in which they’re declared is complete. Thus, regardless of the … Read more

What is the difference between C++03 `throw()` specifier and C++11 `noexcept`?

Exception specifiers were deprecated because exception specifiers are generally a terrible idea. noexcept was added because it’s the one reasonably useful use of an exception specifier: knowing when a function won’t throw an exception. Thus it becomes a binary choice: functions that will throw and functions that won’t throw. noexcept was added rather than just … Read more

Is there an automatic noexcept specifier?

Currently there is none. There is, however, a proposal on that topic, which proposes noexcept(auto) syntax: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4473 The status of this proposal is “needs further work”, according to Botond Ballo’s “Trip Report: C++ Standards Meeting in Lenexa, May 2015” https://botondballo.wordpress.com/2015/06/05/trip-report-c-standards-meeting-in-lenexa-may-2015/ Further Work. The proposal’s direction is promising, but it is either not fleshed out well … Read more

Difference between C++03 throw() specifier C++11 noexcept

Exception specifiers were deprecated because exception specifiers are generally a terrible idea. noexcept was added because it’s the one reasonably useful use of an exception specifier: knowing when a function won’t throw an exception. Thus it becomes a binary choice: functions that will throw and functions that won’t throw. noexcept was added rather than just … Read more