From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 20D4A3857C5A; Fri, 3 Mar 2023 16:33:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20D4A3857C5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677861205; bh=2GJ3UDdNht+aeeyRkPNFGp/HQkzdQTxD/8wGxXnYJ6Y=; h=From:To:Subject:Date:From; b=oo+TJSJTHjHAOCEtACt3vv72YxQ9a+lKhbP/i8wTO9YZgDk+ajps/WFQyAj9aq4qu aqKgteS+KwputwlBAW57zsK/2ldBVow2DqHyN+9+yupJ8wBmZBBgl+n3llC61TqBlY Uml+eUN/R6psz+vTjoTNKaHr+2I8gDCTtktCwvLY= From: "stevenxia990430 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109012] New: Repeated error messages when using -std=c++23 Date: Fri, 03 Mar 2023 16:33:24 +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: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stevenxia990430 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 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=3D109012 Bug ID: 109012 Summary: Repeated error messages when using -std=3Dc++23 Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stevenxia990430 at gmail dot com Target Milestone: --- The following incomplete program repeatedly reports the same error message = on GCC 12 with =E2=80=9C-std=3Dc++23=E2=80=9D flag. To quickly reproduce: https://gcc.godbolt.org/z/Ehzde5o4T ``` #include template myClass>>>> myFunction(T item) { std::cout << "Hello World!"; } ``` So the C++23 parser seems to have a bug. If we remove =E2=80=9C-std=3Dc++23= =E2=80=9D it only reports the concise error message once: https://gcc.godbolt.org/z/38Gxne859 Additionally, this also occurs for even syntactically invalid code snippets. For example this code ``` myClass>>>>((( myFunction(int item) ``` Also observe the same behavior, although clearly it is syntactically invali= d. This correct program compiles in less than 1 second with =E2=80=9Cg++ -c -s= td=3Dc++23 correct.cpp=E2=80=9D ``` #include template class myClass { public: void myFunction(const T item); }; template myClass>>>> myFunction(T item) { std::cout << "Hello World!"; } ``` correct.cpp=