#include <type_traits> template<typename T>class Test{ static_assert( std::is_same<int, T>::value || std::is_same<double, T>::value || std::is_same<float, T>::value, "T must be int, double or float" );}; int main(){ Test<int> t1; Test<char> t2; return 0;}
Standard input is empty
prog.cpp: In instantiation of 'class Test<char>': prog.cpp:17:13: required from here prog.cpp:6:5: error: static assertion failed: T must be int, double or float static_assert( ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!