fork(3) download
  1. //Title of this code
  2. //clang 3.6.0
  3.  
  4. #include <iostream>
  5.  
  6. template <typename fT>
  7. struct return_type;
  8.  
  9. template <typename R, typename ...Args>
  10. struct return_type<R(Args...)>
  11. {
  12. using type = R;
  13. };
  14.  
  15. struct A
  16. {
  17. template <class T>
  18. using X = void();
  19.  
  20. template <class T>
  21. X<T> x;
  22. };
  23.  
  24. template <typename T>
  25. typename return_type<A::X<T>>::type A::x()
  26. {
  27. std::cout << __PRETTY_FUNCTION__ << std::endl;
  28. }
  29.  
  30. int main()
  31. {
  32. A a;
  33.  
  34. a.x<void>();
  35. a.x<int>();
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:25:32: error: 'type' in 'struct return_type<A::X<T> >' does not name a type
 typename return_type<A::X<T>>::type A::x()
                                ^
prog.cpp:25:37: error: prototype for 'int A::x()' does not match any in class 'A'
 typename return_type<A::X<T>>::type A::x()
                                     ^
prog.cpp:21:10: error: candidate is: template<class T> void A::x()
     X<T> x;
          ^
stdout
Standard output is empty