https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88320
Bug ID: 88320 Summary: GCC suggests variables that don't exist yet Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jg at jguk dot org Target Milestone: --- Suggestion on line 5 of a variable which is acutally the return value, and doesn't exist yet. Better to only suggest alternative as variables that exist already in scope? $ g++-8 -Wall -O2 -o suggest var_suggest.cpp var_suggest.cpp: In function ‘int main()’: var_suggest.cpp:5:19: error: ‘aresults’ was not declared in this scope int aresult = aresults +1; ^~~~~~~~ var_suggest.cpp:5:19: note: suggested alternative: ‘aresult’ int aresult = aresults +1; ^~~~~~~~ aresult var_suggest.cpp:4:9: warning: unused variable ‘vresults1’ [-Wunused-variable] int vresults1 = 0;