Consider the following class:
struct S { template<typename T> std::enable_if_t<std::is_void<T>::value> f() noexcept {} template<typename T> std::enable_if_t<not std::is_void<T>::value> g() noexcept {} };
As expected, this compiles:
sf<void>();
This is not instead of:
sg<void>();
I am puzzled by the following main command with GCC (6.2) and it does not compile with clang (3.9):
int main() { static_assert(noexcept(&S::f<void>), "!"); static_assert(noexcept(&S::g<void>), "!"); }
I would say that the second statement failed due to invalid specialization. These two compilers do not agree with this.
Which one is correct?
source share