From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A9B5C3858D28; Sun, 9 Apr 2023 20:10:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9B5C3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681071046; bh=AIEt9AVmhBuKwhHdNG6WsjSk+RJ4QH6ExYLZFhzs974=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Uir3VzPuqh5G+Gh34ZlV8zQMES6+vPj9ygQ0IaD0pVaqIwiJNjUr0ilbXfAKCNukH +3tQuICM+U5hs+iGs+CSYiHQevOf6TYZi+i0sI9N5YIYsMAGOi0Tsvb2gh6tAuAfyd rhJ126ZNBgrdUqdYAKzw2ziyMg4UJfA8bJiFuswY= From: "jg at jguk dot 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 20:10:45 +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: jg at jguk dot 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 #8 from Jonny Grant --- (In reply to Xi Ruoyao from comment #7) > (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. >=20 > This is just blind luck. All of these compilers attempt to "fix" the syn= tax > error by adding "}" at line 8 (not line 6!) and produce further warnings.= =20 > 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. >=20 > Strictly speaking all of them are false warnings as there is no excess > elements in the initializer (according to the programmer's mind). But the > only thing the parser can do is guessing the programmer wanted a "}" at l= ine > 8. ok, thank you for your further replies=