public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL)
       [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
@ 2021-04-28 15:53 ` ppalka at gcc dot gnu.org
  2021-04-29 17:43 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-28 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
                 CC|                            |ppalka at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL)
       [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
  2021-04-28 15:53 ` [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL) ppalka at gcc dot gnu.org
@ 2021-04-29 17:43 ` cvs-commit at gcc dot gnu.org
  2021-04-29 17:44 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-29 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:efeca0ac4155b76ce713155f190422aac20537c5

commit r12-295-gefeca0ac4155b76ce713155f190422aac20537c5
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Apr 29 13:43:00 2021 -0400

    c++: Overeager use of deleted function before ADL [PR68942]

    Here, at template definition time, ordinary name lookup for 'foo(t)'
    finds only the deleted function, and so we form a CALL_EXPR thereof.
    Later at instantiation time, when initially substituting into this
    CALL_EXPR with T=N::A, we end up calling mark_used on this deleted
    function (since it's the only function in the overload set), triggering
    a bogus "use of deleted function error", before we get to augment the
    overload set via ADL.

    This patch fixes this issue by using the tf_conv flag to disable
    mark_used during the initial substitution into the callee of a
    CALL_EXPR when KOENIG_P, since at this point we're still figuring out
    which functions are candidates.

    gcc/cp/ChangeLog:

            PR c++/68942
            * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: When KOENIG_P,
            set tf_conv during the initial substitution into the function.

    gcc/testsuite/ChangeLog:

            PR c++/68942
            * g++.dg/template/koenig12.C: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL)
       [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
  2021-04-28 15:53 ` [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL) ppalka at gcc dot gnu.org
  2021-04-29 17:43 ` cvs-commit at gcc dot gnu.org
@ 2021-04-29 17:44 ` ppalka at gcc dot gnu.org
  2021-05-03 17:36 ` cvs-commit at gcc dot gnu.org
  2022-10-06 20:11 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-29 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12, thanks for the bug report.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL)
       [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-04-29 17:44 ` ppalka at gcc dot gnu.org
@ 2021-05-03 17:36 ` cvs-commit at gcc dot gnu.org
  2022-10-06 20:11 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-03 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:eef4fa6968ae0682679c27dae06409db3d113d5d

commit r12-391-geef4fa6968ae0682679c27dae06409db3d113d5d
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 3 13:35:26 2021 -0400

    c++: mark_used and ADL with template-id [PR100344]

    My r11-295 patch for PR68942 didn't consider that the callee of an
    ADL-eligible function call can be a TEMPLATE_ID_EXPR, and we don't want
    to disable mark_used when substituting into the template arguments of
    this TEMPLATE_ID_EXPR because the arguments are clearly used regardless
    of the outcome of ADL.  In the first testcase below, this oversight
    causes us to trip over the assert in build_call_a for the call to
    find_index<int> because the function no longer had its TREE_USED bit set
    from mark_used.

    So this patch restricts the original fix to disable mark_used only when
    the callee is a FUNCTION_DECL, which seems to be the only case that
    matters for PR68942.  For instance, in the second testcase below we
    already don't mark_used the deleted function specialization even before
    r11-295.

    gcc/cp/ChangeLog:

            PR c++/68942
            PR c++/100344
            * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: Set tf_conv
            only when the callee is a FUNCTION_DECL.

    gcc/testsuite/ChangeLog:

            PR c++/68942
            PR c++/100344
            * g++.dg/template/call8.C: New test.
            * g++.dg/template/koenig12a.C: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL)
       [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-05-03 17:36 ` cvs-commit at gcc dot gnu.org
@ 2022-10-06 20:11 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-06 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |physhivam at gmail dot com

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107175 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-06 20:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-68942-4@http.gcc.gnu.org/bugzilla/>
2021-04-28 15:53 ` [Bug c++/68942] overly strict use of deleted function before argument-dependent lookup (ADL) ppalka at gcc dot gnu.org
2021-04-29 17:43 ` cvs-commit at gcc dot gnu.org
2021-04-29 17:44 ` ppalka at gcc dot gnu.org
2021-05-03 17:36 ` cvs-commit at gcc dot gnu.org
2022-10-06 20:11 ` pinskia at gcc dot gnu.org

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).