fork(1) download
  1. #include <type_traits>
  2.  
  3. template<class T>
  4. void func(T arg) {
  5. static_assert(!std::is_pointer<T>::value, "The argument to func must not be a pointer.");
  6. }
  7.  
  8. int main() {
  9. int i = 2;
  10. func(i);
  11. func(&i);
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void func(T) [with T = int*]':
prog.cpp:11:10:   instantiated from here
prog.cpp:5:3: error: static assertion failed: "The argument to func must not be a pointer."
stdout
Standard output is empty