C++: fix ordering of missing std #include suggestion (PR c++/81514)
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 18 Aug 2017 18:12:47 +0000 (18:12 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 18 Aug 2017 18:12:47 +0000 (18:12 +0000)
commitf661e57ee8fef0b121ec2d79f9e5fea20932c2ae
treeecb7f9ac9fda8d6d73edb72948e0924569ec7397
parent676c4146f504d5252df1a3fb39bb5c4099bc0791
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.

From-SVN: r251186
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