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++/105842] rejects-valid: static member function overload set constrained by concepts for class template results in ambiguous call
Date: Thu, 21 Jul 2022 16:48:19 +0000	[thread overview]
Message-ID: <bug-105842-4-ydIzKvFm9o@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105842-4@http.gcc.gnu.org/bugzilla/>

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

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

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

commit r12-8605-g5d6286903f325a7a85e5ab1d04ba942d33d755bc
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 13 14:01:28 2022 -0400

    c++: dependence of constrained memfn from current inst [PR105842]

    Here we incorrectly deem the calls to func1, func2 and tmpl2 as
    ambiguous ahead of time ultimately because we mishandle dependence
    of a constrained member function from the current instantiation.

    In type_dependent_expression_p, we already consider dependence of a
    TEMPLATE_DECL's constraints (via uses_outer_template_parms), but
    neglect to do the same for a FUNCTION_DECL (such as that for func1).

    And in satisfy_declaration_constraints, we give up if _any_ template
    argument is dependent, but for non-dependent member functions from
    the current instantiation (such as func2 and tmpl2), we can and must
    check constraints as long as the innermost arguments aren't dependent.

            PR c++/105842

    gcc/cp/ChangeLog:

            * constraint.cc (satisfy_declaration_constraints): Refine early
            exit test for argument dependence.
            * cp-tree.h (uses_outer_template_parms_in_constraints): Declare.
            * pt.cc (template_class_depth): Handle TI_TEMPLATE being a
            FIELD_DECL.
            (usse_outer_template_parms): Factor out constraint dependence
            test into ...
            (uses_outer_template_parms_in_constraints): ... here.
            (type_dependent_expression_p): Use it for FUNCTION_DECL.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit f07778f6f92111aa0abfd0f669b148a0bda537a9)

  parent reply	other threads:[~2022-07-21 16:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 21:04 [Bug c++/105842] New: " joeloser at fastmail dot com
2022-06-06 12:39 ` [Bug c++/105842] " ppalka at gcc dot gnu.org
2022-07-01 12:22 ` ppalka at gcc dot gnu.org
2022-07-13 18:03 ` cvs-commit at gcc dot gnu.org
2022-07-13 18:05 ` ppalka at gcc dot gnu.org
2022-07-21 16:48 ` cvs-commit at gcc dot gnu.org [this message]
2022-07-21 16:51 ` ppalka at gcc dot gnu.org
2022-07-27 21:02 ` joeloser at fastmail dot com

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-105842-4-ydIzKvFm9o@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).