#include <iostream>
#include <type_traits>
#include <vector>
template <typename T>
struct is_foo
{
static bool const value = true;
};
template<
typename Ty,
bool foo = std::is_fundamental<std::remove_reference<Ty>::type>::value
>
struct bar {
static bool const value = true;
};
int main() {
int elem;
std::cout << bar<decltype(elem)>::value << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dHlwZV90cmFpdHM+CiNpbmNsdWRlIDx2ZWN0b3I+CnRlbXBsYXRlIDx0eXBlbmFtZSBUPgpzdHJ1Y3QgaXNfZm9vCnsKCXN0YXRpYyBib29sIGNvbnN0IHZhbHVlID0gdHJ1ZTsKfTsKdGVtcGxhdGU8Cgl0eXBlbmFtZSBUeSwKCWJvb2wgZm9vID0gc3RkOjppc19mdW5kYW1lbnRhbDxzdGQ6OnJlbW92ZV9yZWZlcmVuY2U8VHk+Ojp0eXBlPjo6dmFsdWUKPgpzdHJ1Y3QgYmFyIHsKCXN0YXRpYyBib29sIGNvbnN0IHZhbHVlID0gdHJ1ZTsKfTsKaW50IG1haW4oKSB7CglpbnQgZWxlbTsKCXN0ZDo6Y291dCA8PCBiYXI8ZGVjbHR5cGUoZWxlbSk+Ojp2YWx1ZSA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gMDsKfQ==
prog.cpp:11:64: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp> struct std::is_fundamental’
bool foo = std::is_fundamental<std::remove_reference<Ty>::type>::value
^
prog.cpp:11:64: error: expected a type, got ‘std::remove_reference< <template-parameter-1-1> >::type’
prog.cpp: In function ‘int main()’:
prog.cpp:18:33: error: template argument 2 is invalid
std::cout << bar<decltype(elem)>::value << std::endl;
^