fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T>
  5. T diff(T a, T b)
  6. {
  7. static_assert(std::is_signed<T>::value);
  8. return a-b;
  9. }
  10.  
  11.  
  12. int main() {
  13. diff<int>(3,2);
  14. diff<unsigned char> (1,2);
  15. return 0;
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘T diff(T, T) [with T = unsigned char]’:
prog.cpp:14:26:   required from here
prog.cpp:7:2: error: static assertion failed
  static_assert(std::is_signed<T>::value);
  ^~~~~~~~~~~~~
stdout
Standard output is empty