#include <type_traits>
template <
typename T,
typename = typename std::enable_if <std::is_same <T, unsigned int>{}>::type
>
void f(T x) { }
int main ()
{
int x;
unsigned int y;
f(x);
f(y);
}
I2luY2x1ZGUgPHR5cGVfdHJhaXRzPgoKdGVtcGxhdGUgPAoJdHlwZW5hbWUgVCwKCXR5cGVuYW1lID0gdHlwZW5hbWUgc3RkOjplbmFibGVfaWYgPHN0ZDo6aXNfc2FtZSA8VCwgdW5zaWduZWQgaW50Pnt9Pjo6dHlwZQo+CnZvaWQgZihUIHgpIHsgfQoKCmludCBtYWluICgpCnsKCWludCB4OwoJdW5zaWduZWQgaW50IHk7CglmKHgpOwoJZih5KTsKfQo=
prog.cpp: In function ‘int main()’:
prog.cpp:14:5: error: no matching function for call to ‘f(int&)’
f(x);
^
prog.cpp:14:5: note: candidate is:
prog.cpp:7:6: note: template<class T, class> void f(T)
void f(T x) { }
^
prog.cpp:7:6: note: template argument deduction/substitution failed:
prog.cpp:5:2: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
typename = typename std::enable_if <std::is_same <T, unsigned int>{}>::type
^