fork(1) download
  1. #include <boost/noncopyable.hpp>
  2.  
  3. class Key
  4. {
  5. friend class Copain;
  6. Key() {}
  7. Key(Key const&) {}
  8. };
  9.  
  10. void semiprivate(Key) {}
  11.  
  12. struct Copain
  13. {
  14. Key key;
  15.  
  16. void test()
  17. {
  18. semiprivate(key);
  19. }
  20. };
  21.  
  22. void other() {
  23. Copain c;
  24. semiprivate(c.key);
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void other()’:
prog.cpp:7: error: ‘Key::Key(const Key&)’ is private
prog.cpp:24: error: within this context
prog.cpp:24: error:   initializing argument 1 of ‘void semiprivate(Key)’
stdout

Standard output is empty