fork(1) download
  1. struct A
  2. {
  3. template <typename T>
  4. static auto fun() -> typename T::type { }
  5. };
  6.  
  7. struct C
  8. {
  9. // doh! forgot to add typedef!
  10. };
  11.  
  12. int main() {
  13. A::fun<C>();
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:12: error: no matching function for call to ‘A::fun()’
  A::fun<C>();
            ^
prog.cpp:13:12: note: candidate is:
prog.cpp:4:15: note: template<class T> static typename T::type A::fun()
   static auto fun() -> typename T::type { }
               ^
prog.cpp:4:15: note:   template argument deduction/substitution failed:
prog.cpp: In substitution of ‘template<class T> static typename T::type A::fun() [with T = C]’:
prog.cpp:13:12:   required from here
prog.cpp:4:15: error: no type named ‘type’ in ‘struct C’
stdout
Standard output is empty