From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 18C7D3858C1F; Wed, 7 Jun 2023 21:49:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18C7D3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686174577; bh=kneKFoJdZqkXQLvzbf2IRoA3fyg4o6/uburBS47rbko=; h=From:To:Subject:Date:From; b=hzeG+of2ypm+5XIRaJX+j/VNgDL3TKSPxHqixUxX7UqSz86UtnAxbXRqMrc202cV8 T59l0UH2/+O3Sw6gWIFBZHFq6p7c5Ye7Q0TmV0Yd0TIz3kjfOmyrVvJTlB0j5ZAgvW rdUv0UTvR3DHBOrF4xMryA10bPU89tioVyu1/BJ8= From: "rs2740 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110164] New: Improve diagnostic for incomplete standard library types due to missing include Date: Wed, 07 Jun 2023 21:49:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rs2740 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110164 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 stan= dard library type, GCC helpfully reminds me of the header: $ echo 'std::array x;' | g++ -x c++ - :1:6: error: =E2=80=98array=E2=80=99 in namespace =E2=80=98std=E2=80= =99 does not name a template type :1:1: note: =E2=80=98std::array=E2=80=99 is defined in header =E2=80= =98=E2=80=99; did you forget to =E2=80=98#include =E2=80=99? 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 \nstd::array x;' | g++ -x c++ - :2:21: error: aggregate =E2=80=98std::array x=E2=80=99 has = incomplete type and cannot be defined It would be nice if the latter case also has a hint about the potential mis= sing include.=