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

Reply via email to