fork download
  1. #include <iostream>
  2. using namespace std;
  3. struct MyType { MyType() { cout << __PRETTY_FUNCTION__ << endl; }};
  4. MyType& MyType() { cout << __PRETTY_FUNCTION__ << endl; }
  5. using MyType2 = struct MyType;
  6. int main() {
  7. // MyType t; <- error: expected ‘;’ before ‘t’
  8. MyType();
  9. struct MyType t;
  10. struct MyType t1 = MyType();
  11. struct MyType t2 = (struct MyType)::MyType();
  12. struct MyType t3 = MyType2();
  13. new(&t2) struct MyType();
  14. return 0;
  15. }
Success #stdin #stdout 0s 4404KB
stdin
Standard input is empty
stdout
MyType& MyType()
MyType::MyType()
MyType& MyType()
MyType& MyType()
MyType::MyType()
MyType::MyType()