From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A25F53851C36; Fri, 12 Jun 2020 17:32:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A25F53851C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591983166; bh=YXFmJ+IBRGuksRF5GAXOxr3iqK0POTpNV5AnMPxLc6Q=; h=From:To:Subject:Date:From; b=x6akRUZrAMMRYwAXMK6aGKLRgpHw8RgYusy06ZZ74LGzpJlS43Ge6bN2S5fm/AOdx gurjjGPhf3fR2pjwlcgPuP6SHaHT6heUyF7lomReT4GvwTHaCvKA/QuY/CfVbBu0UU u5BkHiEXKn7jrXsS1gJJWQwFSeq8WHtWv5JZEy60= From: "haoxintu at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95659] New: Inconsistent error message in "default argument missing for parameter" Date: Fri, 12 Jun 2020 17:32:46 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: haoxintu 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 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, 12 Jun 2020 17:32:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95659 Bug ID: 95659 Summary: Inconsistent error message in "default argument missing for parameter" Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- $cat bug.cc int a; long foo1 ( void =3D a, double param2 ,decltype (auto) param3 =3D a){ } long foo2 ( void =3D a, double param2){ } In gcc-trunk $g++-trunk -w -c -std=3Dc++14 bug.cc=20 bug.cc:2:41: error: cannot declare a parameter with =E2=80=98decltype(auto)= =E2=80=99 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ^~~~~~~~~~~~~~~ bug.cc:2:14: error: invalid use of type =E2=80=98void=E2=80=99 in parameter= declaration 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ^~~~~~~~~ bug.cc:3:14: error: invalid use of type =E2=80=98void=E2=80=99 in parameter= declaration 3 | long foo2 ( void =3D a, double param2){ } | ^~~~~~~~~ bug.cc:3:33: error: default argument missing for parameter 2 of =E2=80=98lo= ng int foo2(, double)=E2=80=99 3 | long foo2 ( void =3D a, double param2){ } | ~~~~~~~~^~~~~~ bug.cc:3:14: note: ...following parameter 1 which has a default argument 3 | long foo2 ( void =3D a, double param2){ } | ^~~~~~~~~ GCC-trunk misses the "default argument missing for parameter" error message= in function "foo1()" but gives the message in function "foo2()". In other GCC versions, they have consitent results, for example in GCC-10 $g++-10 -w -c -std=3Dc++14 bug.cc=20 bug.cc:2:41: error: cannot declare a parameter with =E2=80=98decltype(auto)= =E2=80=99 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ^~~~~~~~~~~~~~~ bug.cc:2:14: error: invalid use of type =E2=80=98void=E2=80=99 in parameter= declaration 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ^~~~~~~~~ bug.cc:2:33: error: default argument missing for parameter 2 of =E2=80=98lo= ng int foo1(, double)=E2=80=99 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ~~~~~~~~^~~~~~ bug.cc:2:14: note: ...following parameter 1 which has a default argument 2 | long foo1 ( void =3D a, double param2 ,decltype (auto) param3 = =3D a){ } | ^~~~~~~~~ bug.cc:3:14: error: invalid use of type =E2=80=98void=E2=80=99 in parameter= declaration 3 | long foo2 ( void =3D a, double param2){ } | ^~~~~~~~~ bug.cc:3:33: error: default argument missing for parameter 2 of =E2=80=98lo= ng int foo2(, double)=E2=80=99 3 | long foo2 ( void =3D a, double param2){ } | ~~~~~~~~^~~~~~ bug.cc:3:14: note: ...following parameter 1 which has a default argument 3 | long foo2 ( void =3D a, double param2){ } | ^~~~~~~~~=