From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B2C733858C2C; Fri, 21 Jan 2022 14:48:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2C733858C2C From: "nickhuang99 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104113] invalid template argument causes the type to become int which confuses the rest of the diagnostic Date: Fri, 21 Jan 2022 14:48:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic, FIXME X-Bugzilla-Severity: normal X-Bugzilla-Who: nickhuang99 at hotmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jan 2022 14:48:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104113 --- Comment #5 from qingzhe huang --- Created attachment 52257 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52257&action=3Dedit cp_parser_simulate_error logic diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index b262b765a9a..988631a4248 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -24206,8 +24206,9 @@ cp_parser_type_id_1 (cp_parser *parser, cp_parser_f= lags flags, /* OK */; else { - if (!cp_parser_simulate_error (parser)) - { + if (parser->context && parser->context->status =3D=3D CP_PARSER_STATUS_KIND_ERROR + && cp_parser_simulate_error (parser)) + return error_mark_node; location_t loc =3D type_specifier_seq.locations[ds_type_spe= c]; if (tree tmpl =3D CLASS_PLACEHOLDER_TEMPLATE (auto_node)) { @@ -24221,8 +24222,6 @@ cp_parser_type_id_1 (cp_parser *parser, cp_parser_f= lags flags, auto_node); else error_at (loc, "invalid use of %qT", auto_node); - } - return error_mark_node; } }=