fork download
  1. #include <utility>
  2. #include <type_traits>
  3.  
  4. struct B;
  5.  
  6. struct A {
  7. void operator *(const B &) {}
  8. };
  9. struct B {
  10. void operator *(int x) const {}
  11. };
  12.  
  13. inline void operator *(int a, const B & b) {
  14. return b * a;
  15. }
  16.  
  17. template <typename T, typename C = std::remove_reference<decltype(std::declval<T>)>::type> T & f(C c = C()) {
  18. return c;
  19. }
  20.  
  21. int main() {
  22.  
  23. f<A>();
  24.  
  25. }
Compilation error #stdin compilation error #stdout 0s 2880KB
stdin
Standard input is empty
compilation info
prog.cpp:17:36: error: expected type-specifier
prog.cpp:17:36: error: expected '>'
prog.cpp: In function 'int main()':
prog.cpp:23:10: error: no matching function for call to 'f()'
stdout
Standard output is empty