public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include @ 2023-06-07 21:49 rs2740 at gmail dot com 2023-06-07 21:56 ` [Bug c++/110164] " pinskia at gcc dot gnu.org ` (5 more replies) 0 siblings, 6 replies; 7+ messages in thread From: rs2740 at gmail dot com @ 2023-06-07 21:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 Bug ID: 110164 Summary: Improve diagnostic for incomplete standard library types due to missing include Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rs2740 at gmail dot com Target Milestone: --- If I forget to include a header before using a sufficiently well-known standard library type, GCC helpfully reminds me of the header: $ echo 'std::array<int, 10> x;' | g++ -x c++ - <stdin>:1:6: error: ‘array’ in namespace ‘std’ does not name a template type <stdin>:1:1: note: ‘std::array’ is defined in header ‘<array>’; did you forget to ‘#include <array>’? But if I happen to have a different standard library header included that happens to bring in a forward declaration of the type, the error message is less helpful: $ echo -e '#include <map>\nstd::array<int, 10> x;' | g++ -x c++ - <stdin>:2:21: error: aggregate ‘std::array<int, 10> x’ has incomplete type and cannot be defined It would be nice if the latter case also has a hint about the potential missing include. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com @ 2023-06-07 21:56 ` pinskia at gcc dot gnu.org 2023-06-13 22:51 ` dmalcolm at gcc dot gnu.org ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-06-07 21:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Last reconfirmed| |2023-06-07 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=39730 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com 2023-06-07 21:56 ` [Bug c++/110164] " pinskia at gcc dot gnu.org @ 2023-06-13 22:51 ` dmalcolm at gcc dot gnu.org 2023-06-21 20:41 ` dmalcolm at gcc dot gnu.org ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dmalcolm at gcc dot gnu.org @ 2023-06-13 22:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |dmalcolm at gcc dot gnu.org --- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this. I'm testing a patch for it. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com 2023-06-07 21:56 ` [Bug c++/110164] " pinskia at gcc dot gnu.org 2023-06-13 22:51 ` dmalcolm at gcc dot gnu.org @ 2023-06-21 20:41 ` dmalcolm at gcc dot gnu.org 2023-06-21 20:50 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: dmalcolm at gcc dot gnu.org @ 2023-06-21 20:41 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |https://gcc.gnu.org/piperma | |il/gcc-patches/2023-June/62 | |1779.html Keywords| |patch Status|ASSIGNED |WAITING Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org --- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Patch posted here awaiting review: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621779.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com ` (2 preceding siblings ...) 2023-06-21 20:41 ` dmalcolm at gcc dot gnu.org @ 2023-06-21 20:50 ` pinskia at gcc dot gnu.org 2023-06-23 21:57 ` cvs-commit at gcc dot gnu.org 2023-06-23 22:03 ` dmalcolm at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-06-21 20:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |ASSIGNED --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Waiting status is for waiting from the reporter of the bug; in this case it is waiting on approval of the patch rather than waiting on the reporter so assigned is the correct status. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com ` (3 preceding siblings ...) 2023-06-21 20:50 ` pinskia at gcc dot gnu.org @ 2023-06-23 21:57 ` cvs-commit at gcc dot gnu.org 2023-06-23 22:03 ` dmalcolm at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-06-23 21:57 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>: https://gcc.gnu.org/g:13709b518aa9769ef427e48ce5c9583fbe098777 commit r14-2055-g13709b518aa9769ef427e48ce5c9583fbe098777 Author: David Malcolm <dmalcolm@redhat.com> Date: Fri Jun 23 17:56:14 2023 -0400 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> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/110164] Improve diagnostic for incomplete standard library types due to missing include 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com ` (4 preceding siblings ...) 2023-06-23 21:57 ` cvs-commit at gcc dot gnu.org @ 2023-06-23 22:03 ` dmalcolm at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: dmalcolm at gcc dot gnu.org @ 2023-06-23 22:03 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110164 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Should be fixed on trunk for gcc 14 by the above patch. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-06-23 22:03 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-06-07 21:49 [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include rs2740 at gmail dot com 2023-06-07 21:56 ` [Bug c++/110164] " pinskia at gcc dot gnu.org 2023-06-13 22:51 ` dmalcolm at gcc dot gnu.org 2023-06-21 20:41 ` dmalcolm at gcc dot gnu.org 2023-06-21 20:50 ` pinskia at gcc dot gnu.org 2023-06-23 21:57 ` cvs-commit at gcc dot gnu.org 2023-06-23 22:03 ` dmalcolm at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).