fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3. #include <vector>
  4. template <typename T>
  5. struct is_foo
  6. {
  7. static bool const value = true;
  8. };
  9. template<
  10. typename Ty,
  11. bool foo = std::is_fundamental<std::remove_reference<Ty>::type>::value
  12. >
  13. struct bar {
  14. static bool const value = true;
  15. };
  16. int main() {
  17. int elem;
  18. std::cout << bar<decltype(elem)>::value << std::endl;
  19. return 0;
  20. }
Compilation error #stdin compilation error #stdout 0s 3344KB
stdin
Standard input is empty
compilation info
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;
                                 ^
stdout
Standard output is empty