public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-102137-4-gwXUvwZ3Px@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102137-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102137 --- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:e32869a17b788bee9ca782b174a546b1db17b5ea commit r12-7563-ge32869a17b788bee9ca782b174a546b1db17b5ea Author: Patrick Palka <ppalka@redhat.com> 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_ONLYCONVERTING 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 constructors seems unaffacted thanks to code in build_aggr_init that sets LOOKUP_ONLYCONVERTING when the initializer represents copy-initialization. So this patch fixes this by making cp_finish_decl set LOOKUP_ONLYCONVERTING 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.
next prev parent reply other threads:[~2022-03-09 13:44 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-30 23:40 [Bug c++/102137] New: " johelegp at gmail dot com 2021-08-31 13:57 ` [Bug c++/102137] " redi at gcc dot gnu.org 2021-08-31 15:02 ` ppalka at gcc dot gnu.org 2022-03-09 13:44 ` cvs-commit at gcc dot gnu.org [this message] 2022-03-09 13:53 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102137-4-gwXUvwZ3Px@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).