https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105680
Bug ID: 105680 Summary: undefined type after new does not give a helpful error message Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: struct settype{}; void g(void){ new setype(); } --- CUT --- There is a typo in g for settype missing one character. GCC gives: <source>: In function 'void g()': <source>:4:9: error: expected type-specifier before 'setype' 4 | new setype(); | ^~~~~~ I looked at this a few times to see what my mistake was and I finally figured it out. Clang gives a much better error message: <source>:4:9: error: unknown type name 'setype'; did you mean 'settype'? new setype(); ^~~~~~ settype <source>:1:8: note: 'settype' declared here struct settype{}; ^