fork(1) download
  1. class Bar
  2. {
  3. Bar(Bar const&) = default;
  4. Bar(Bar&&) = default;
  5.  
  6. public:
  7. Bar() = default;
  8.  
  9. friend int main();
  10. };
  11.  
  12. void fooA(const Bar& bar)
  13. {
  14. //Bar bar_copy(bar); // error: 'constexpr Bar::Bar(const Bar&)' is private
  15. }
  16.  
  17. void fooB(Bar bar) { }
  18.  
  19. int main()
  20. {
  21. fooB(Bar()); // OK: Main is friend
  22. }
Success #stdin #stdout 0s 3136KB
stdin
Standard input is empty
stdout
Standard output is empty