https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81514
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Author: dmalcolm Date: Fri Aug 18 18:12:47 2017 New Revision: 251186 URL: https://gcc.gnu.org/viewcvs?rev=251186&root=gcc&view=rev Log: C++: fix ordering of missing std #include suggestion (PR c++/81514) gcc/cp/ChangeLog: PR c++/81514 * name-lookup.c (maybe_suggest_missing_header): Convert return type from void to bool; return true iff a suggestion was offered. (suggest_alternative_in_explicit_scope): Move call to maybe_suggest_missing_header to before use of best_match, and return true if the former offers a suggestion. gcc/testsuite/ChangeLog: PR c++/81514 * g++.dg/lookup/empty.h: New file. * g++.dg/lookup/missing-std-include-2.C: Replace include of stdio.h with empty.h and a declaration of a "std::sprintf" not based on a built-in. Added: trunk/gcc/testsuite/g++.dg/lookup/empty.h Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C