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

            Bug ID: 95263
           Summary: ice in lookup_template_class_1
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C++ code

enum a { b };
template <class, a, class = int, class = int> class c;
template <class ac, a ad = b> using d = c<ac, ad>;
template <class> class f { template <class, a> using aj = int; };
template <class g> class h {
public:
  using an = f<g>;
  template <class ai, a ad> using aj = typename an::aj<ai, ad>;
  template <a> void aw();
  template <a ad, class ai> aj<ai, ad> aw();
};
template <class, a ad, class, class> class c : h<c<int, ad>> {
public:
  c();
};
template <class az, a ad, class ba, class bb> c<az, ad, ba, bb>::c() {
  this->template aw<b>();
}
void i() { d<int> e; }

on recent gcc trunk, does this:

bug610.cc: In substitution of ‘template<class g> template<class ai, a ad> using 
aj = typename h<g>::an::aj<ai, ad> [with ai = ai; a ad = b; g = c<int, b, int,
i
nt>]’:
bug610.cc:10:40:   required by substitution of ‘template<a ad, class ai>
h<c<int
, b, int, int> >::aj<ai, ad> h<c<int, b, int, int> >::aw<ad, ai>() [with a ad = 
b; ai = <missing>]’
bug610.cc:17:23:   required from ‘c< <template-parameter-1-1>, <anonymous>,
<tem
plate-parameter-1-3>, <template-parameter-1-4> >::c() [with
<template-parameter-
1-1> = int; a ad = b; <template-parameter-1-3> = int; <template-parameter-1-4>
=
 int]’
bug610.cc:19:19:   required from here
bug610.cc:8:35: internal compiler error: in lookup_template_class_1, at
cp/pt.c:
10076
    8 |   template <class ai, a ad> using aj = typename an::aj<ai, ad>;
      |                                   ^~
0x82a5b3 lookup_template_class_1(tree_node*, tree_node*, tree_node*,
tree_node*,
 int, int)
        ../../trunk.git/gcc/cp/pt.c:10075
0x828739 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
i
nt, int)
        ../../trunk.git/gcc/cp/pt.c:10128
0x815633 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../trunk.git/gcc/cp/pt.c:15831

The bug first seems to occur sometime between 20200519 and 20200520.

Reply via email to