public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99911] New: C++20 adl issue
@ 2021-04-04 23:32 denis.yaroshevskij at gmail dot com
  2021-04-06  8:05 ` [Bug c++/99911] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: denis.yaroshevskij at gmail dot com @ 2021-04-04 23:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99911
           Summary: C++20 adl issue
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.yaroshevskij at gmail dot com
  Target Milestone: ---

GCC cannot find a function using ADL (clang finds it fine)
https://gcc.godbolt.org/z/PM4fxah9b

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
@ 2021-04-06  8:05 ` rguenth at gcc dot gnu.org
  2021-04-06  8:20 ` denis.yaroshevskij at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-06  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |11.0
           Keywords|                            |rejects-valid

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Please provide the testcase not only through a godbolt link.

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
  2021-04-06  8:05 ` [Bug c++/99911] " rguenth at gcc dot gnu.org
@ 2021-04-06  8:20 ` denis.yaroshevskij at gmail dot com
  2021-04-06  8:21 ` denis.yaroshevskij at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: denis.yaroshevskij at gmail dot com @ 2021-04-06  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Denis Yaroshevskiy <denis.yaroshevskij at gmail dot com> ---
Created attachment 50510
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50510&action=edit
Test Case (-std=c++20 -O3)

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
  2021-04-06  8:05 ` [Bug c++/99911] " rguenth at gcc dot gnu.org
  2021-04-06  8:20 ` denis.yaroshevskij at gmail dot com
@ 2021-04-06  8:21 ` denis.yaroshevskij at gmail dot com
  2021-11-10 14:03 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: denis.yaroshevskij at gmail dot com @ 2021-04-06  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Denis Yaroshevskiy <denis.yaroshevskij at gmail dot com> ---
Also removed catch dependency from godbolt if that was the issue:
https://gcc.godbolt.org/z/1YEoeeP93

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-06  8:21 ` denis.yaroshevskij at gmail dot com
@ 2021-11-10 14:03 ` marxin at gcc dot gnu.org
  2021-11-10 14:06 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-10 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-reduction             |
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced that to:

$ cat pr99911.C
#include <tuple>
auto tuple_flatten() {
  []<std::size_t... idxs> { tuple_cat(get<idxs>()...); };
}

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (3 preceding siblings ...)
  2021-11-10 14:03 ` marxin at gcc dot gnu.org
@ 2021-11-10 14:06 ` redi at gcc dot gnu.org
  2021-11-10 15:25 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-10 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That isn't valid though.

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (4 preceding siblings ...)
  2021-11-10 14:06 ` redi at gcc dot gnu.org
@ 2021-11-10 15:25 ` ppalka at gcc dot gnu.org
  2021-11-18 15:05 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-11-10 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

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
                 CC|                            |ppalka at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-11-10
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=102760
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reduced rejects-valid testcase:

namespace N {
  struct A { };
  template<class T> void get(A);
};

template<class T>
auto tuple_flatten() {
  return [] <class U> (U) { get<U>(T{}); };
}

int main() {
  tuple_flatten<N::A>()(0);
}

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (5 preceding siblings ...)
  2021-11-10 15:25 ` ppalka at gcc dot gnu.org
@ 2021-11-18 15:05 ` cvs-commit at gcc dot gnu.org
  2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
  2021-12-15 19:57 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-18 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:90de06a7b3ce6ae8381136e58a2dde91fbbb6eff

commit r12-5373-g90de06a7b3ce6ae8381136e58a2dde91fbbb6eff
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Nov 18 10:05:13 2021 -0500

    c++: template-id ADL and partial instantiation [PR99911]

    Here when partially instantiating the call get<U>(T{}) with T=N::A
    (for which earlier unqualified name lookup for 'get' found nothing)
    the arguments after substitution are no longer dependent but the callee
    still is, so perform_koenig_lookup postpones ADL.  But then we go on to
    diagnose the unresolved template name anyway, as if ADL was already
    performed and failed.

    This patch fixes this by avoiding the error path in question when the
    template arguments of an unresolved template-id are still dependent,
    mirroring the dependence check in perform_koenig_lookup.

            PR c++/99911

    gcc/cp/ChangeLog:

            * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: Don't diagnose
            name lookup failure if the arguments to an unresolved template
            name are still dependent.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/fn-template24.C: New test.

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (6 preceding siblings ...)
  2021-11-18 15:05 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
  2021-12-15 19:57 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-15 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:5a2c4c1e171d2681a506f6de2235a32293e69b3f

commit r11-9389-g5a2c4c1e171d2681a506f6de2235a32293e69b3f
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Nov 18 10:05:13 2021 -0500

    c++: template-id ADL and partial instantiation [PR99911]

    Here when partially instantiating the call get<U>(T{}) with T=N::A
    (for which earlier unqualified name lookup for 'get' found nothing)
    the arguments after substitution are no longer dependent but the callee
    still is, so perform_koenig_lookup postpones ADL.  But then we go on to
    diagnose the unresolved template name anyway, as if ADL was already
    performed and failed.

    This patch fixes this by avoiding the error path in question when the
    template arguments of an unresolved template-id are still dependent,
    mirroring the dependence check in perform_koenig_lookup.

            PR c++/99911

    gcc/cp/ChangeLog:

            * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: Don't diagnose
            name lookup failure if the arguments to an unresolved template
            name are still dependent.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/fn-template24.C: New test.

    (cherry picked from commit 90de06a7b3ce6ae8381136e58a2dde91fbbb6eff)

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

* [Bug c++/99911] C++20 adl issue
  2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
                   ` (7 preceding siblings ...)
  2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
@ 2021-12-15 19:57 ` ppalka at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-12-15 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.3/12.

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

end of thread, other threads:[~2021-12-15 19:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04 23:32 [Bug c++/99911] New: C++20 adl issue denis.yaroshevskij at gmail dot com
2021-04-06  8:05 ` [Bug c++/99911] " rguenth at gcc dot gnu.org
2021-04-06  8:20 ` denis.yaroshevskij at gmail dot com
2021-04-06  8:21 ` denis.yaroshevskij at gmail dot com
2021-11-10 14:03 ` marxin at gcc dot gnu.org
2021-11-10 14:06 ` redi at gcc dot gnu.org
2021-11-10 15:25 ` ppalka at gcc dot gnu.org
2021-11-18 15:05 ` cvs-commit at gcc dot gnu.org
2021-12-15 19:55 ` cvs-commit at gcc dot gnu.org
2021-12-15 19:57 ` ppalka 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).