fork download
  1. template<typename T, int j, int i>
  2. struct error {
  3. int err[i];
  4. };
  5.  
  6. template<typename T>
  7. struct S {
  8. S(T t = 0) {
  9. error<decltype(t), sizeof(t), -1> e;
  10. }
  11. };
  12.  
  13. int main() {
  14. S<int[2]> s;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'error<int [2], 4, -0x000000001>':
prog.cpp:9:39:   instantiated from 'S<T>::S(T) [with T = int [2]]'
prog.cpp:14:13:   instantiated from here
prog.cpp:3:12: error: creating array with negative size ('-0x000000001')
stdout
Standard output is empty