From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C4E293858415; Wed, 15 Dec 2021 19:55:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4E293858415 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102933] Can't use CTAD in template argument Date: Wed, 15 Dec 2021 19:55:16 +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: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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 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, 15 Dec 2021 19:55:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102933 --- Comment #2 from CVS Commits --- The releases/gcc-11 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:76c730cbf051281ff088ec18ee4f89fee4a8305a commit r11-9387-g76c730cbf051281ff088ec18ee4f89fee4a8305a Author: Patrick Palka Date: Thu Oct 28 10:46:46 2021 -0400 c++: CTAD within template argument [PR102933] Here when checking for erroneous occurrences of 'auto' inside a template argument (which is allowed by the concepts TS for class templates), extract_autos_r picks up the CTAD placeholder for X{T{0}} which causes check_auto_in_tmpl_args to reject this valid template argument. This patch fixes this by making extract_autos_r ignore CTAD placeholders. However, it seems we don't need to call check_auto_in_tmpl_args at all outside of the concepts TS since using 'auto' as a type-id is otherwise rejected more generally at parse time. So this patch makes the function just exit early if !flag_concepts_ts. Similarly, I think the concepts code paths in do_auto_deduction and type_uses_auto are only necessary for the concepts TS, so this patch also restricts these code paths accordingly. PR c++/102933 gcc/cp/ChangeLog: * parser.c (cp_parser_simple_type_specifier): Adjust diagnostic for using auto in parameter declaration. * pt.c (extract_autos_r): Ignore CTAD placeholders. (extract_autos): Use range-based for. (do_auto_deduction): Use extract_autos only for the concepts TS and not also for standard concepts. (type_uses_auto): Likewise with for_each_template_parm. (check_auto_in_tmpl_args): Just return false outside of the concepts TS. Simplify. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class50.C: New test. * g++.dg/cpp2a/nontype-class50a.C: New test. (cherry picked from commit f70f17d03630fd948bc15a646ebe7e784125c4d4)=