https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91013
Bug ID: 91013 Summary: member function can have same name as constructor if declared using a typedef Product: gcc Version: 9.1.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org CC: blelbach at cct dot lsu.edu Target Milestone: --- G++ accepts this ill-formed program: using F = void(); class A { F A; }; Clang doesn't: ctor.cc:3:5: error: constructor cannot have a return type F A; ~ ^ 1 error generated. EDG doesn't: "ctor.cc", line 3: error: member function with the same name as its class must be a constructor F A; ^ 1 error detected in the compilation of "ctor.cc".