diff options
author | David Malcolm <dmalcolm@redhat.com> | 2023-06-23 17:56:14 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2023-06-23 17:56:14 -0400 |
commit | 13709b518aa9769ef427e48ce5c9583fbe098777 (patch) | |
tree | ef85153f19cd97cffba1f43c86dc985123649f4c /libjava/java | |
parent | 5388a43f6a3f348929292998bd6d0c1da6f006de (diff) | |
download | gcc-13709b518aa9769ef427e48ce5c9583fbe098777.zip gcc-13709b518aa9769ef427e48ce5c9583fbe098777.tar.gz gcc-13709b518aa9769ef427e48ce5c9583fbe098777.tar.bz2 |
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>
Diffstat (limited to 'libjava/java')
0 files changed, 0 insertions, 0 deletions