From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46B7E3858CDA; Sun, 9 Apr 2023 09:04:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46B7E3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681031083; bh=thdslSfN5ApfHLB1xg4A4zuVrwR0RydwtWvoVoXHMrM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UzhxOf+jcQcAOAfLEutccSLnwGhMPX+6UmQBWhRApQEiG8YaePuLQ6z59RVZOuHRp jBZ+vHL7ZDs/ydyfD7u/OScHx8jOhOHvVDLmmsLT9aasPg3Fschzq7dq8JLNeIAVNJ AC/l9igd8C4dR4boxi7MSqBkfca3LjfPZW9srzzM= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109356] Enhancement idea to provide clearer missing brace line number Date: Sun, 09 Apr 2023 09:04:42 +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: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109356 --- Comment #7 from Xi Ruoyao --- (In reply to Jonny Grant from comment #6) > Tried a few other compilers on godbolt.=20 >=20 > ICC gets the warning on line 6 > https://godbolt.org/z/fYb9c8f61 >=20 > nvc++ gives the warning on line 6=20 > https://godbolt.org/z/xvh67odzY >=20 > MSVC and Clang don't. This is just blind luck. All of these compilers attempt to "fix" the syntax error by adding "}" at line 8 (not line 6!) and produce further warnings. = It's just ICC and nvc++ report "excess elements in initializer" at the beginning= of the initializer, while the other compilers report it at the end. Strictly speaking all of them are false warnings as there is no excess elem= ents in the initializer (according to the programmer's mind). But the only thing the parser can do is guessing the programmer wanted a "}" at line 8.=