fork(3) download
  1. template <typename T>
  2. struct type_name_is {};
  3.  
  4. template <typename T>
  5. void type_name_error(const T&)
  6. {
  7. // will error with type name:
  8. type_name_is<T>::showing_type_name();
  9. }
  10.  
  11. int main()
  12. {
  13. type_name_error(42u + -43);
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void type_name_error(const T&) [with T = unsigned int]’:
prog.cpp:13:   instantiated from here
prog.cpp:8: error: ‘showing_type_name’ is not a member of ‘type_name_is<unsigned int>’
stdout
Standard output is empty