fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. void f(std::string) { std::cout << "string\n"; }
  5. struct bar;
  6. struct foo {
  7. friend void f(const bar&) {std::cout << "bar\n"; }
  8. struct baz { operator bar&(); };
  9. };
  10. struct bar : foo {};
  11. foo::baz::operator bar&() { static bar x; return x; }
  12.  
  13. template <typename T> struct foobar { operator bar() { return {}; }; };
  14. int main() {
  15. f(bar{});
  16. f(foo::baz{});
  17. f(foobar<bar>{});
  18. }
Success #stdin #stdout 0s 4372KB
stdin
Standard input is empty
stdout
bar
bar
bar