#include <type_traits> template<class T> void func(T arg) { static_assert(!std::is_pointer<T>::value, "The argument to func must not be a pointer."); } int main() { int i = 2; func(i); func(&i); }
Standard input is empty
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."
Standard output is empty