public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95036] New: ICE with variadic type/nttp template templates
@ 2020-05-10 13:29 vince.rev at gmail dot com
  2020-05-11  0:45 ` [Bug c++/95036] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: vince.rev at gmail dot com @ 2020-05-10 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95036
           Summary: ICE with variadic type/nttp template templates
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vince.rev at gmail dot com
  Target Milestone: ---

Created attachment 48497
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48497&action=edit
ICE with variadic type/nttp template templates

The following code in std=c++17 (I couldn't make it smaller because I don't
know where the bug is coming from) compiles correctly with gcc 7 and 8, but
fails with gcc 9 and 10. Link to godbolt: https://godbolt.org/z/x_66lB

================================================================================
#include <array>
#include <utility>
#include <type_traits>

template <template <class, auto...> class Template>
struct base {
    template <template <class, auto...> class, class = void>
    struct is_same_template: std::false_type {};
    template <class Dummy>
    struct is_same_template<Template, Dummy>: std::true_type {};
    template <
        template <class, auto...> class X,
        class = std::enable_if_t<is_same_template<X>::value>
    >
    constexpr void function() const noexcept {};
};

template <template <class, auto...> class... Templates>
struct derived: base<Templates>... {
    using base<Templates>::function...;
};

int main(int, char**) {
    derived<std::array, std::integer_sequence> x;
    x.function<std::array>();
}
================================================================================

The error message is :
--------------------------------------------------------------------------------
gcc-ice-2020-05-10.cpp: In substitution of 'template<template<class, auto
...<anonymous> > class X, class> constexpr void
base<std::integer_sequence>::function<X, <template-parameter-1-2> >() const
[with X = std::array; <template-parameter-1-2> = <missing>]':
gcc-ice-2020-05-10.cpp:25:28:   required from here
gcc-ice-2020-05-10.cpp:10:12: internal compiler error: in tsubst, at
cp/pt.c:14592
   10 |     struct is_same_template<Template, Dummy>: std::true_type {};
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
--------------------------------------------------------------------------------

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic type/nttp template templates
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
@ 2020-05-11  0:45 ` mpolacek at gcc dot gnu.org
  2020-05-11  1:01 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-11  0:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |9.4
   Last reconfirmed|                            |2020-05-11
            Summary|ICE with variadic type/nttp |[9/10/11 Regression] ICE
                   |template templates          |with variadic type/nttp
                   |                            |template templates
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic type/nttp template templates
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
  2020-05-11  0:45 ` [Bug c++/95036] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-05-11  1:01 ` mpolacek at gcc dot gnu.org
  2020-05-11  1:06 ` mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-11  1:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r9-6853-g17838af989014f5e90e3a7ab4e519d495c03e726

namespace a {
template <int b> struct c { static constexpr int d = b; };
template <bool, typename e = void> using f = e;
template <typename e, e...> struct g;
template <typename> struct array;
} // namespace a
template <template <class> class h> struct i {
  template <template <class, auto...> class, class = void> struct n;
  template <class j> struct n<h, j> : a::c<true> {};
  template <template <class> class k, class = a::f<n<k>::d>> void function();
};
template <template <class> class... l> struct derived : i<l>... {
  using i<l>::function...;
};
int main() {
  derived<a::array, a::g> m;
  m.function<a::array>();
}

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic type/nttp template templates
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
  2020-05-11  0:45 ` [Bug c++/95036] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
  2020-05-11  1:01 ` mpolacek at gcc dot gnu.org
@ 2020-05-11  1:06 ` mpolacek at gcc dot gnu.org
  2020-05-12 20:23 ` jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-11  1:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic type/nttp template templates
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-11  1:06 ` mpolacek at gcc dot gnu.org
@ 2020-05-12 20:23 ` jason at gcc dot gnu.org
  2021-06-01  8:17 ` [Bug c++/95036] [9/10/11/12 Regression] ICE with variadic template template parameters rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-12 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/95036] [9/10/11/12 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-12 20:23 ` jason at gcc dot gnu.org
@ 2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-02-15  5:06 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug c++/95036] [9/10/11/12 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (4 preceding siblings ...)
  2021-06-01  8:17 ` [Bug c++/95036] [9/10/11/12 Regression] ICE with variadic template template parameters rguenth at gcc dot gnu.org
@ 2022-02-15  5:06 ` cvs-commit at gcc dot gnu.org
  2022-02-16  0:12 ` [Bug c++/95036] [9/10/11 " jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-15  5:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

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

commit r12-7236-g2c3309e3d0f5cb8f298f7604848d115f0992e04f
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 10 17:57:38 2022 -0500

    c++: TTP in member alias template [PR104107]

    In the first testcase, coerce_template_template_parms was adding too much
of
    outer_args when coercing to match P's template parameters, so that when
    substituting into the 'const T&' parameter we got an unrelated template
    argument for T.  We should only add outer_args when the argument template
is
    a nested template.

            PR c++/104107
            PR c++/95036

    gcc/cp/ChangeLog:

            * pt.cc (coerce_template_template_parms): Take full parms.
            Avoid adding too much of outer_args.
            (coerce_template_template_parm): Adjust.
            (template_template_parm_bindings_ok_p): Adjust.
            (convert_template_argument): Adjust.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/alias-decl-ttp2.C: New test.
            * g++.dg/cpp1z/ttp2.C: New test.

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (5 preceding siblings ...)
  2022-02-15  5:06 ` cvs-commit at gcc dot gnu.org
@ 2022-02-16  0:12 ` jason at gcc dot gnu.org
  2022-03-28 19:13 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-16  0:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.0
            Summary|[9/10/11/12 Regression] ICE |[9/10/11 Regression] ICE
                   |with variadic template      |with variadic template
                   |template parameters         |template parameters

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 12 so far.

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

* [Bug c++/95036] [9/10/11 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (6 preceding siblings ...)
  2022-02-16  0:12 ` [Bug c++/95036] [9/10/11 " jason at gcc dot gnu.org
@ 2022-03-28 19:13 ` cvs-commit at gcc dot gnu.org
  2022-05-27  9:42 ` [Bug c++/95036] [10 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:450e82794245c49248711f1479c491d84cb46c57

commit r11-9708-g450e82794245c49248711f1479c491d84cb46c57
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 10 17:57:38 2022 -0500

    c++: TTP in member alias template [PR104107]

    In the first testcase, coerce_template_template_parms was adding too much
of
    outer_args when coercing to match P's template parameters, so that when
    substituting into the 'const T&' parameter we got an unrelated template
    argument for T.  We should only add outer_args when the argument template
is
    a nested template.

            PR c++/104107
            PR c++/95036

    gcc/cp/ChangeLog:

            * pt.c (coerce_template_template_parms): Take full parms.
            Avoid adding too much of outer_args.
            (coerce_template_template_parm): Adjust.
            (template_template_parm_bindings_ok_p): Adjust.
            (convert_template_argument): Adjust.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/alias-decl-ttp2.C: New test.
            * g++.dg/cpp1z/ttp2.C: New test.

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

* [Bug c++/95036] [10 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (7 preceding siblings ...)
  2022-03-28 19:13 ` cvs-commit at gcc dot gnu.org
@ 2022-05-27  9:42 ` rguenth at gcc dot gnu.org
  2022-06-28 10:40 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c++/95036] [10 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (8 preceding siblings ...)
  2022-05-27  9:42 ` [Bug c++/95036] [10 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:40 ` jakub at gcc dot gnu.org
  2023-03-15 12:45 ` cvs-commit at gcc dot gnu.org
  2023-07-07  8:51 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/95036] [10 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (9 preceding siblings ...)
  2022-06-28 10:40 ` jakub at gcc dot gnu.org
@ 2023-03-15 12:45 ` cvs-commit at gcc dot gnu.org
  2023-07-07  8:51 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-15 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:3ea64aad06a2b32739028bae03b9b9a5691d2d30

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

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

    I kept trying to improve our choice of how many levels of outer_args to
add,
    when really the problem was that outer_args are for PARM and for this
    reverse deduction we should be adding the outer arguments for ARG.

    I spent quite a while trying to get DECL_CONTEXT set consistently on
    template template parameters that have gone through
    reduce_template_parm_level before I realized I could just use
    current_scope().

            PR c++/108179
            PR c++/104107
            PR c++/95036

    gcc/cp/ChangeLog:

            * pt.cc (coerce_template_template_parms): Use args from
            DECL_CONTEXT (arg_tmpl) instead of outer_args.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/95036] [10 Regression] ICE with variadic template template parameters
  2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
                   ` (10 preceding siblings ...)
  2023-03-15 12:45 ` cvs-commit at gcc dot gnu.org
@ 2023-07-07  8:51 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.3
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |10.5.0, 11.2.0
      Known to work|                            |11.3.0

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 11.3.

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

end of thread, other threads:[~2023-07-07  8:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 13:29 [Bug c++/95036] New: ICE with variadic type/nttp template templates vince.rev at gmail dot com
2020-05-11  0:45 ` [Bug c++/95036] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
2020-05-11  1:01 ` mpolacek at gcc dot gnu.org
2020-05-11  1:06 ` mpolacek at gcc dot gnu.org
2020-05-12 20:23 ` jason at gcc dot gnu.org
2021-06-01  8:17 ` [Bug c++/95036] [9/10/11/12 Regression] ICE with variadic template template parameters rguenth at gcc dot gnu.org
2022-02-15  5:06 ` cvs-commit at gcc dot gnu.org
2022-02-16  0:12 ` [Bug c++/95036] [9/10/11 " jason at gcc dot gnu.org
2022-03-28 19:13 ` cvs-commit at gcc dot gnu.org
2022-05-27  9:42 ` [Bug c++/95036] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:40 ` jakub at gcc dot gnu.org
2023-03-15 12:45 ` cvs-commit at gcc dot gnu.org
2023-07-07  8:51 ` rguenth 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).