From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0BF1D3857C64; Wed, 9 Mar 2022 13:44:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BF1D3857C64 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102137] class template argument deduction with template template parameter allows explicit deduction guide Date: Wed, 09 Mar 2022 13:44:18 +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: accepts-invalid 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: --- 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, 09 Mar 2022 13:44:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102137 --- Comment #3 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:e32869a17b788bee9ca782b174a546b1db17b5ea commit r12-7563-ge32869a17b788bee9ca782b174a546b1db17b5ea Author: Patrick Palka Date: Wed Mar 9 08:42:32 2022 -0500 c++: detecting copy-init context during CTAD [PR102137] Here we're failing to communicate to cp_finish_decl from tsubst_expr that we're in a copy-initialization context (via the LOOKUP_ONLYCONVERT= ING flag), which causes us to always consider explicit deduction guides when performing CTAD for a templated variable initializer. It turns out this bug also affects consideration of explicit conversion operators for the same reason. But consideration of explicit construct= ors seems unaffacted thanks to code in build_aggr_init that sets LOOKUP_ONLYCONVERTING when the initializer represents copy-initializati= on. So this patch fixes this by making cp_finish_decl set LOOKUP_ONLYCONVER= TING just like build_aggr_init does, by inspecting the initializer, so that callers don't need to explicitly pass this flag appropriately. PR c++/102137 PR c++/87820 gcc/cp/ChangeLog: * cp-tree.h (is_copy_initialization): Declare. * decl.cc (cp_finish_decl): Set LOOKUP_ONLYCONVERTING when is_copy_initialization is true. * init.cc (build_aggr_init): Split out copy-initialization check into ... (is_copy_initialization): ... here. * pt.cc (instantiate_decl): Pass 0 instead of LOOKUP_ONLYCONVERTING as flags to cp_finish_decl. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/explicit15.C: New test. * g++.dg/cpp1z/class-deduction108.C: New test.=