fork download
  1. #include <memory>
  2.  
  3. struct Widget
  4. {
  5. struct Impl;
  6. std::unique_ptr<Impl> impl;
  7. void f();
  8. };
  9.  
  10. int main()
  11. {
  12. Widget w;
  13. }
  14.  
  15. // The above breaks when you put the below into a separate TU
  16.  
  17. struct Widget::Impl { void f() {} };
  18.  
  19. void Widget::f() { impl->f(); }
  20.  
  21.  
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty