]>
gcc.gnu.org Git - gcc.git/commit
c++: provide #include hint for missing includes [PR110164]
PR c++/110164 notes that in cases where we have a forward decl
of a std library type such as:
std::array<int, 10> x;
we emit this diagnostic:
error: aggregate ‘std::array<int, 10> x’ has incomplete type and cannot be defined
This patch adds this hint to the diagnostic:
note: ‘std::array’ is defined in header ‘<array>’; this is probably fixable by adding ‘#include <array>’
gcc/cp/ChangeLog:
PR c++/110164
* cp-name-hint.h (maybe_suggest_missing_header): New decl.
* decl.cc: Define INCLUDE_MEMORY. Add include of
"cp/cp-name-hint.h".
(start_decl_1): Call maybe_suggest_missing_header.
* name-lookup.cc (maybe_suggest_missing_header): Remove "static".
gcc/testsuite/ChangeLog:
PR c++/110164
* g++.dg/diagnostic/missing-header-pr110164.C: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
This page took 0.057863 seconds and 5 git commands to generate.