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++/102412] Template argument deduction fails when using concept as defaulted non-type template parameter
Date: Wed, 06 Oct 2021 14:15:36 +0000	[thread overview]
Message-ID: <bug-102412-4-YRp0j6aCIZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102412-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102412

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:5a411459b73b65d8a1235a16d6e2aac4eed17338

commit r11-9082-g5a411459b73b65d8a1235a16d6e2aac4eed17338
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Sep 22 11:16:53 2021 -0400

    c++: concept-ids and value-dependence [PR102412]

    The problem here is that uses_template_parms returns true for all
    concept-ids (even those with non-dependent arguments), so when a concept-id
    is used as a default template argument then during deduction the default
    argument is considered dependent even after substituting into it, which
    leads to deduction failure (from type_unification_real).

    This patch fixes this by implementing the resolution of CWG 2446 which
    says a concept-id is dependent only if its arguments are.

            DR 2446
            PR c++/102412

    gcc/cp/ChangeLog:

            * constexpr.c (cxx_eval_constant_expression)
            <case TEMPLATE_ID_EXPR>: Check value_dependent_expression_p
            instead of processing_template_decl.
            * pt.c (value_dependent_expression_p) <case TEMPLATE_ID_EXPR>:
            Return true only if any_dependent_template_arguments_p.
            (instantiation_dependent_r) <case CALL_EXPR>: Remove this case.
            <case TEMPLATE_ID_EXPR>: Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-nondep2.C: New test.
            * g++.dg/cpp2a/concepts-nondep3.C: New test.

    (cherry picked from commit 9329344a6d81a6a5e3bd171167ebc7b158bb44f4)

  parent reply	other threads:[~2021-10-06 14:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 16:45 [Bug c++/102412] New: " joeloser93 at gmail dot com
2021-09-20 18:36 ` [Bug c++/102412] " ppalka at gcc dot gnu.org
2021-09-22 15:18 ` cvs-commit at gcc dot gnu.org
2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org [this message]
2021-10-06 14:19 ` 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-102412-4-YRp0j6aCIZ@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: link
Be 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).