A modest proposal for a GCC diagnostic

template<class T, class U>
auto less(const T& t, const U& u)
    noexcept(noexcept(noexcept(t < u)))
                      ^~~~~~~~
warning: 'noexcept(noexcept(noexcept' is too noexcept for GCC

Notice that noexcept(noexcept(false)) is a synonym for noexcept(true).

Someone the other day asked how many times in a row we have to write [[unlikely]] before it turns into __builtin_unreachable().

The number of times you need to write noexcept in a row, before it turns into noexcept(true), is exactly three.

Posted 2018-04-09