mardi 10 mars 2015

void_t in parameter list works but not as return type

There's an example on cppreference about the using alias. This example fails because int has no member foo:



template<typename...> using void_t = void;
template<typename T> void_t<typename T::foo> f();
f<int>(); // error, int does not have a nested type foo


This is clear, but when I tried putting the void_t part in the parameter list it unexpectedly compiled:



template<typename...> using void_t = void;
template<typename T> void f(void_t<typename T::foo>);
f<int>();


It compiles on clang but not in gcc. Is this a bug?


Aucun commentaire:

Enregistrer un commentaire