You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will print out 1 and 0, which means that it fails to specialize the (d) reference version. I tried it on gcc and it prints 1 and 1. Alternatively, if I left struct X undefined in the declaration (instead of inheriting from false_type), it will give me a compiler error "implicit instantiation of undefined template" only for the second instantiation, whereas in gcc it will succeed instantiating both.
The text was updated successfully, but these errors were encountered:
Extended Description
Code:
#include <type_traits>
#include
// definition
template <bool, decltype(auto)> struct X : std::false_type {};
// sepcialization
template <decltype(auto) val>
struct X<true, val> : std::true_type {};
using namespace std;
const double d = 10.0;
int main()
{
cout << X<true, 1>::value << '\n';
cout << X<true, (d)>::value << '\n';
}
Will print out 1 and 0, which means that it fails to specialize the (d) reference version. I tried it on gcc and it prints 1 and 1. Alternatively, if I left struct X undefined in the declaration (instead of inheriting from false_type), it will give me a compiler error "implicit instantiation of undefined template" only for the second instantiation, whereas in gcc it will succeed instantiating both.
The text was updated successfully, but these errors were encountered: