From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3959A3857C65; Wed, 19 Jan 2022 10:46:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3959A3857C65 From: "nickhuang99 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104113] New: DR 625 forbids "auto" being used in template argument and parser fails to issue correct error message for it Date: Wed, 19 Jan 2022 10:46:26 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nickhuang99 at hotmail 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: Wed, 19 Jan 2022 10:46:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104113 Bug ID: 104113 Summary: DR 625 forbids "auto" being used in template argument and parser fails to issue correct error message for it Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickhuang99 at hotmail dot com Target Milestone: --- DR 625 forbids "auto" to be used in template argument. And developer has specific error message for this and fails to issue it for the very case: (https://www.godbolt.org/z/198fn1jr1) template struct A {}; template void f(A x) {} void g() { f(A()); A x =3D A(); } The error message is very misleading. Note that only the 2nd error message = is parser confirmed error message which is considered as conversion issue inst= ead of "auto" being forbidden to be in template argument. (The 1st error messag= e is parser tentative parsing issued.) : In function 'void g()': :14:11: error: template argument 1 is invalid 14 | A x =3D A(); | ^ :14:17: error: cannot convert 'A' to 'int' in initializa= tion 14 | A x =3D A(); | ^~~~~~~~~~ | | | A And this case can be reduced as=20 template struct A{}; A x =3D A(); This is related to PR104091, however, it is very different because this one= is not affected by "-std=3Dc++XX"=