https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80684
Bug ID: 80684 Summary: poor error message and fix-it hint for a function with an argument of undeclared type Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- G++ issues the following confusing error messages for a function declaration involving the undeclared type string (where std::string from <string> was meant but the header was not included). The suggested alternative only makes things worse. $ cat y.C && gcc -S -Wall -Wextra -Wpedantic y.C void f (string); y.C:1:15: error: variable or field ‘f’ declared void void f (string); ^ y.C:1:9: error: ‘string’ was not declared in this scope void f (string); ^~~~~~ y.C:1:9: note: suggested alternative: ‘struct’ void f (string); ^~~~~~ struct In contrast, clang simply prints the much clearer: y.C:1:9: error: unknown type name 'string'