C++: fix ordering of missing std #include suggestion (PR c++/81514)
commit55058771df400b88e0428d6f56df854c47a1d97f
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Aug 2017 18:12:47 +0000 (18 18:12 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Aug 2017 18:12:47 +0000 (18 18:12 +0000)
treeecb7f9ac9fda8d6d73edb72948e0924569ec7397
parent21b932faac20b613fcb482c4bd996fb9acf0c1da
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251186 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/empty.h [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/missing-std-include-2.C