fork download
  1. #include <iostream>
  2. typedef void (*vfunp)(...);
  3.  
  4. template <typename A>
  5. struct X
  6. {
  7. void a1 () { (int)(vfunp)A::foo<2>(5); };
  8. void a2 () { (int)(vfunp)A::template foo<2>(5); }
  9.  
  10. };
  11.  
  12. struct Y
  13. {
  14. static void foo(...) { }
  15. template <int> static void* foo(...) { std::cout << "Oops!" << std::endl; return 0; }
  16. };
  17.  
  18. int main ()
  19. {
  20. X<Y> moo;
  21. moo.a1();
  22. moo.a2();
  23. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Oops!