fork(2) download
  1. template<bool, typename>
  2. struct enable_if
  3. {
  4. };
  5.  
  6. template<typename T>
  7. struct enable_if<true, T>
  8. {
  9. typedef T type;
  10. };
  11.  
  12. template<int i>
  13. struct foo
  14. {
  15. template <typename enable_if<i==1, int>::type>
  16. void helper(int){}
  17.  
  18. void f(int, char){}
  19. void f(int z){ helper<0>(z); }
  20. };
  21.  
  22. int main()
  23. {
  24. foo<2> k;
  25. k.f(0, 0);
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘struct foo<2>’:
prog.cpp:24:9:   required from here
prog.cpp:16:10: error: no type named ‘type’ in ‘struct enable_if<false, int>’
     void helper(int){}
          ^
stdout
Standard output is empty