public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda
@ 2020-05-30  5:34 johelegp at gmail dot com
  2020-05-30  5:41 ` [Bug c++/95434] " johelegp at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: johelegp at gmail dot com @ 2020-05-30  5:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95434
           Summary: ICE for CTAD in generic lambda within variadic lambda
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

The following snippet ICEs. See https://godbolt.org/z/-fZVX4.
```C++
template <class T> struct type { T value; };
template <class T> type(T) -> type<T>;
void f()
{
    []<template <class> class... Ts>()
    {
        (..., []<template <class> class T>() {
            T{0};
        }.template operator()<Ts>());
    }
    .template operator()<type>();
}

```

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
@ 2020-05-30  5:41 ` johelegp at gmail dot com
  2020-07-14 20:59 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: johelegp at gmail dot com @ 2020-05-30  5:41 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Perhaps it's related to the following snippet that errors. I don't see why it
shouldn't work. Should I open a separate bug report on this?
```C++
template <template <class> class... Ts>
void g()
{
    (..., Ts{0}); // error: operand of fold expression has no unexpanded
parameter packs
}
```

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
  2020-05-30  5:41 ` [Bug c++/95434] " johelegp at gmail dot com
@ 2020-07-14 20:59 ` ppalka at gcc dot gnu.org
  2020-08-12  0:51 ` johelegp at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-07-14 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-14
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  Fails on trunk, too.

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
  2020-05-30  5:41 ` [Bug c++/95434] " johelegp at gmail dot com
  2020-07-14 20:59 ` ppalka at gcc dot gnu.org
@ 2020-08-12  0:51 ` johelegp at gmail dot com
  2021-01-19 15:08 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: johelegp at gmail dot com @ 2020-08-12  0:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Another example: https://godbolt.org/z/Wq1vjP. Perhaps, this too requires
another bug report.
```C++
template <template <class> class T, class... Us>
concept ctadable = requires(Us... us) { T{us...}; };

template <class T>
struct X { T x; };

static_assert(ctadable<X, int>);
```

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-12  0:51 ` johelegp at gmail dot com
@ 2021-01-19 15:08 ` ppalka at gcc dot gnu.org
  2021-01-20 14:55 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-19 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like the testcases in comment #1 and comment #3 are PR98611 and are fixed
for GCC 11 with r11-6614.

We still ICE on your original testcase though.  Reduced:

template <class>
void f() {
  []<template <class> class U>() { U{0}; };
}

template void f<int>();

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2021-01-19 15:08 ` ppalka at gcc dot gnu.org
@ 2021-01-20 14:55 ` cvs-commit at gcc dot gnu.org
  2021-02-03  5:43 ` johelegp at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-20 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r11-6816-gcafcfcb5840b62d9fc80c12192189351e995a4f2
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jan 20 09:44:33 2021 -0500

    c++: Fix tsubsting CLASS_PLACEHOLDER_TEMPLATE [PR95434]

    Here, during partial instantiation of the generic lambda, we do
    tsubst_copy on the CLASS_PLACEHOLDER_TEMPLATE for U{0} which yields a
    (level-lowered) TEMPLATE_TEMPLATE_PARM rather than the corresponding
    TEMPLATE_DECL.  This later confuses do_class_deduction which expects
    that a CLASS_PLACEHOLDER_TEMPLATE is always a TEMPLATE_DECL.

    gcc/cp/ChangeLog:

            PR c++/95434
            * pt.c (tsubst) <case TEMPLATE_TYPE_PARM>: If tsubsting
            CLASS_PLACEHOLDER_TEMPLATE yields a TEMPLATE_TEMPLATE_PARM,
            adjust to its TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL.

    gcc/testsuite/ChangeLog:

            PR c++/95434
            * g++.dg/cpp2a/lambda-generic9.C: New test.

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
                   ` (4 preceding siblings ...)
  2021-01-20 14:55 ` cvs-commit at gcc dot gnu.org
@ 2021-02-03  5:43 ` johelegp at gmail dot com
  2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
  2021-04-20 16:11 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: johelegp at gmail dot com @ 2021-02-03  5:43 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
             Status|ASSIGNED                    |RESOLVED
                URL|                            |https://godbolt.org/z/-fZVX
                   |                            |4
      Known to fail|                            |10.1.0
         Resolution|---                         |FIXED

--- Comment #6 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Thank you.

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
                   ` (5 preceding siblings ...)
  2021-02-03  5:43 ` johelegp at gmail dot com
@ 2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
  2021-04-20 16:11 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 16:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2400f81c2c2489f4b6fbb245ef946a39be40defd

commit r10-9734-g2400f81c2c2489f4b6fbb245ef946a39be40defd
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 20 12:06:27 2021 -0400

    c++: Fix tsubsting CLASS_PLACEHOLDER_TEMPLATE [PR95434]

    Here, during partial instantiation of the generic lambda, we do
    tsubst_copy on the CLASS_PLACEHOLDER_TEMPLATE for U{0} which yields a
    (level-lowered) TEMPLATE_TEMPLATE_PARM rather than the corresponding
    TEMPLATE_DECL.  This later confuses do_class_deduction which expects
    that a CLASS_PLACEHOLDER_TEMPLATE is always a TEMPLATE_DECL.

    gcc/cp/ChangeLog:

            PR c++/95434
            * pt.c (tsubst) <case TEMPLATE_TYPE_PARM>: If tsubsting
            CLASS_PLACEHOLDER_TEMPLATE yields a TEMPLATE_TEMPLATE_PARM,
            adjust to its TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL.

    gcc/testsuite/ChangeLog:

            PR c++/95434
            * g++.dg/cpp2a/lambda-generic9.C: New test.

    (cherry picked from commit cafcfcb5840b62d9fc80c12192189351e995a4f2)

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

* [Bug c++/95434] ICE for CTAD in generic lambda within variadic lambda
  2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
@ 2021-04-20 16:11 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4

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

end of thread, other threads:[~2021-04-20 16:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30  5:34 [Bug c++/95434] New: ICE for CTAD in generic lambda within variadic lambda johelegp at gmail dot com
2020-05-30  5:41 ` [Bug c++/95434] " johelegp at gmail dot com
2020-07-14 20:59 ` ppalka at gcc dot gnu.org
2020-08-12  0:51 ` johelegp at gmail dot com
2021-01-19 15:08 ` ppalka at gcc dot gnu.org
2021-01-20 14:55 ` cvs-commit at gcc dot gnu.org
2021-02-03  5:43 ` johelegp at gmail dot com
2021-04-20 16:09 ` cvs-commit at gcc dot gnu.org
2021-04-20 16:11 ` 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).