public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
@ 2023-07-05 21:52 waffl3x at protonmail dot com
  2023-07-05 22:01 ` [Bug c++/110566] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: waffl3x at protonmail dot com @ 2023-07-05 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110566
           Summary: [13/14 Regression] ICE when instantiating function
                    template with template template parameter with 2 or
                    more auto parameters with a dependent member template,
                    ICE in tsubst, at cp/pt.cc:16135
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: waffl3x at protonmail dot com
  Target Milestone: ---

https://godbolt.org/z/6d4ec5va3

template<template<auto, auto> typename> void takes_templ();

template<typename>
struct v_v_member_templ_fn {
    template<auto, auto>
    using fn = void;
};

using ice = decltype(takes_templ<v_v_member_templ_fn<void>::template fn>());

This one seems kind of boring to me, only interesting things to note are the
ICE only manifests with 2 or more (I assume) auto template parameters, it works
as expected with only a single auto template parameter.
The version of GCC on my local machine that exhibits this behavior is: 13.1.1
20230429

Not as convoluted as I'm used to, but at least that means it should be easy to
fix! One can hope anyway.

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

* [Bug c++/110566] [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
@ 2023-07-05 22:01 ` mpolacek at gcc dot gnu.org
  2023-07-06  8:18 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-07-05 22:01 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |13.2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-07-05

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-6693:

commit 3ea64aad06a2b32739028bae03b9b9a5691d2d30
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 10 14:55:27 2023 -0500

    c++: passing one ttp to another [PR108179]

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

* [Bug c++/110566] [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
  2023-07-05 22:01 ` [Bug c++/110566] " mpolacek at gcc dot gnu.org
@ 2023-07-06  8:18 ` rguenth at gcc dot gnu.org
  2023-07-19 18:45 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-06  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/110566] [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
  2023-07-05 22:01 ` [Bug c++/110566] " mpolacek at gcc dot gnu.org
  2023-07-06  8:18 ` rguenth at gcc dot gnu.org
@ 2023-07-19 18:45 ` mpolacek at gcc dot gnu.org
  2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-07-19 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Patch posted: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624952.html

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

* [Bug c++/110566] [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (2 preceding siblings ...)
  2023-07-19 18:45 ` mpolacek at gcc dot gnu.org
@ 2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
  2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-26 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:b3adcc60dcf3314f47f5409aecef40607f82b80b

commit r14-2809-gb3adcc60dcf3314f47f5409aecef40607f82b80b
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 26 17:21:26 2023 -0400

    c++: passing partially inst tmpl as ttp [PR110566]

    Since the template arguments 'pargs' we pass to coerce_template_parms from
    coerce_template_template_parms are always a full set, we need to make sure
    we always pass the parameters of the most general template because if the
    template is partially instantiated then the levels won't match up.  In the
    testcase below during said call to coerce_template_parms the parameters are
    {X, Y}, both level 1 rather than 2, and the arguments are {{int}, {N, M}},
    which results in a crash during auto deduction for parameters' types.

            PR c++/110566
            PR c++/108179

    gcc/cp/ChangeLog:

            * pt.cc (coerce_template_template_parms): Simplify by using
            DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
            Always pass the parameters of the most general template to
            coerce_template_parms.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/ttp38.C: New test.

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

* [Bug c++/110566] [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (3 preceding siblings ...)
  2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
@ 2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
  2023-07-26 21:24 ` [Bug c++/110566] [13 " ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-26 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:b8218eb2266811991b8163f36d5c1d974cb50b93

commit r14-2810-gb8218eb2266811991b8163f36d5c1d974cb50b93
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 26 17:21:43 2023 -0400

    c++: passing partially inst ttp as ttp [PR110566]

    The previous fix doesn't work for partially instantiated ttps mainly
    because most_general_template is a no-op for them.  This patch fixes
    this by giving such ttps a DECL_TEMPLATE_INFO (extending the
    r11-734-g2fb595f8348e16 fix) with which most_general_template can obtain
    the original, unlowered ttp.

    This patch additionally makes coerce_template_template_parms use the
    correct amount of levels from the scope of a ttp argument.

            PR c++/110566
            PR c++/108179

    gcc/cp/ChangeLog:

            * pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
            on the DECL_TEMPLATE_RESULT of the new ttp.
            (add_defaults_to_ttp): Make a copy of the original ttp's
            DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
            as well.
            (coerce_template_template_parms): Make sure 'scope_args' has
            the right amount of levels for the ttp argument.
            (most_general_template): Handle template template parameters.
            (rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
            DECL_TEMPLATE_RESULT of the new ttp.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction115.C: New test.
            * g++.dg/template/ttp39.C: New test.

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

* [Bug c++/110566] [13 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (4 preceding siblings ...)
  2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
@ 2023-07-26 21:24 ` ppalka at gcc dot gnu.org
  2023-07-26 21:47 ` waffl3x at protonmail dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-26 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=108179
           Keywords|patch                       |
                 CC|                            |ppalka at gcc dot gnu.org
            Summary|[13/14 Regression] ICE when |[13 Regression] ICE when
                   |instantiating function      |instantiating function
                   |template with template      |template with template
                   |template parameter with 2   |template parameter with 2
                   |or more auto parameters     |or more auto parameters
                   |with a dependent member     |with a dependent member
                   |template, ICE in tsubst, at |template, ICE in tsubst, at
                   |cp/pt.cc:16135              |cp/pt.cc:16135
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Should be fixed on trunk so far.

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

* [Bug c++/110566] [13 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (5 preceding siblings ...)
  2023-07-26 21:24 ` [Bug c++/110566] [13 " ppalka at gcc dot gnu.org
@ 2023-07-26 21:47 ` waffl3x at protonmail dot com
  2023-07-27  9:27 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: waffl3x at protonmail dot com @ 2023-07-26 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from waffl3x <waffl3x at protonmail dot com> ---
(In reply to Patrick Palka from comment #5)
> Should be fixed on trunk so far.

Once it shows up on godbolt I will make sure that all the cases that exhibited
the bug are working for me now. I had a bunch of different combinations of
typename and auto and anything with 2 or more autos were breaking.
If I had to guess, I imagine they all should all be working now, but I'll
double check it to make sure.

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

* [Bug c++/110566] [13 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (6 preceding siblings ...)
  2023-07-26 21:47 ` waffl3x at protonmail dot com
@ 2023-07-27  9:27 ` rguenth at gcc dot gnu.org
  2023-08-07 23:27 ` cvs-commit at gcc dot gnu.org
  2023-08-21 14:09 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug c++/110566] [13 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (7 preceding siblings ...)
  2023-07-27  9:27 ` rguenth at gcc dot gnu.org
@ 2023-08-07 23:27 ` cvs-commit at gcc dot gnu.org
  2023-08-21 14:09 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-07 23:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2c6e76ff039782401f705cacda60c11f8dfac3b1

commit r13-7692-g2c6e76ff039782401f705cacda60c11f8dfac3b1
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Jul 26 17:21:26 2023 -0400

    c++: passing partially inst tmpl as ttp [PR110566]

    Since the template arguments 'pargs' we pass to coerce_template_parms from
    coerce_template_template_parms are always a full set, we need to make sure
    we always pass the parameters of the most general template because if the
    template is partially instantiated then the levels won't match up.  In the
    testcase below during said call to coerce_template_parms the parameters are
    {X, Y}, both level 1 rather than 2, and the arguments are {{int}, {N, M}},
    which results in a crash during auto deduction for parameters' types.

            PR c++/110566
            PR c++/108179

    gcc/cp/ChangeLog:

            * pt.cc (coerce_template_template_parms): Simplify by using
            DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
            Always pass the parameters of the most general template to
            coerce_template_parms.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/ttp38.C: New test.

    (cherry picked from commit b3adcc60dcf3314f47f5409aecef40607f82b80b)

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

* [Bug c++/110566] [13 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135
  2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
                   ` (8 preceding siblings ...)
  2023-08-07 23:27 ` cvs-commit at gcc dot gnu.org
@ 2023-08-21 14:09 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-08-21 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The original testcase (passing a partially instantiated template as a ttp) is
fixed for GCC 13.3.

The follow-up fix r14-2810 (for passing a partially instantiated ttp as a ttp)
doesn't seem suitable for backporting..

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

end of thread, other threads:[~2023-08-21 14:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-05 21:52 [Bug c++/110566] New: [13/14 Regression] ICE when instantiating function template with template template parameter with 2 or more auto parameters with a dependent member template, ICE in tsubst, at cp/pt.cc:16135 waffl3x at protonmail dot com
2023-07-05 22:01 ` [Bug c++/110566] " mpolacek at gcc dot gnu.org
2023-07-06  8:18 ` rguenth at gcc dot gnu.org
2023-07-19 18:45 ` mpolacek at gcc dot gnu.org
2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
2023-07-26 21:22 ` cvs-commit at gcc dot gnu.org
2023-07-26 21:24 ` [Bug c++/110566] [13 " ppalka at gcc dot gnu.org
2023-07-26 21:47 ` waffl3x at protonmail dot com
2023-07-27  9:27 ` rguenth at gcc dot gnu.org
2023-08-07 23:27 ` cvs-commit at gcc dot gnu.org
2023-08-21 14:09 ` 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).