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

            Bug ID: 84296
           Summary: [8 Regression] ICE in finish_member_declaration
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

namespace b {}
namespace c {
using namespace b;
}
namespace b {
template <int d> struct e { static const int f = d; };
}
template <typename> struct g;
template <typename h, typename i, typename aa, typename j>
struct g<h(i, aa, j)> : h::template ab<i, aa, j> {};
struct k {
  template <typename l> struct m { typedef typename g<l>::n o; };
};
template <typename> struct ac;
struct r {
  typedef ac<int> p;
};
template <typename q> struct s : k {
  template <typename i, typename, typename>
  struct ab : q::template t<typename i::u>::template ab<i, int, int> {};
};
struct ad {
  typedef int u;
};
template <typename> struct ae;
template <typename, typename ag> struct ah {
  typedef ae<ag> ai;
  typedef typename ai::template w<ai(r, int)>::o n;
};
struct x {
  template <typename i, typename, typename> struct ab : ah<i, int> {};
};
struct y {
  struct z {
    template <typename> struct t : x {};
  };
  struct aj : s<z> {};
};
template <typename i> struct ak {
  typedef y::aj al;
  typedef typename al::m<al(i, int, int)>::o o;
};
struct am {
  enum { an };
};
template <typename> struct ao {};
template <typename af> struct ap : af::aq {};
template <> struct ae<int> {
  template <typename> struct w;
  template <typename ar, typename as, typename at> struct w<ar(as, at)> {
    typedef typename as::p o;
  };
};
enum { a = b::e<0>::f };
template <typename> class au;
template <typename av> struct ac : ao<av> { typedef c::e<am::an> aq; };
template <typename aw, typename i, typename ax> void ay(aw, i, ax) {
  au<c::e<ap<typename ak<i>::o>::f>> az();
}
void v() {
  ad a;
  void az();
  ay(az, a, v);
}

ICEs starting with r256866 with:
rh1543322.ii: In instantiation of ‘struct b::e<am::an>’:
rh1543322.ii:47:31:   required from ‘struct ap<ac<int> >’
rh1543322.ii:58:38:   required from ‘void ay(aw, i, ax) [with aw = void (*)();
i = ad; ax = void (*)()]’
rh1543322.ii:63:14:   required from here
rh1543322.ii:6:46: internal compiler error: in finish_member_declaration, at
cp/semantics.c:3011
 template <int d> struct e { static const int f = d; };
                                              ^
0xa87722 finish_member_declaration(tree_node*)
        ../../gcc/cp/semantics.c:3011
0xa17da2 instantiate_class_template_1
        ../../gcc/cp/pt.c:10697
0xa188d9 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:10915
0xacd6f6 complete_type(tree_node*)
        ../../gcc/cp/typeck.c:136
0xacd71b complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ../../gcc/cp/typeck.c:148
0xacd7b9 complete_type_or_else(tree_node*, tree_node*)
        ../../gcc/cp/typeck.c:165
0x8d6539 xref_basetypes(tree_node*, tree_node*)
        ../../gcc/cp/decl.c:13765
0xa16e36 instantiate_class_template_1
        ../../gcc/cp/pt.c:10501
0xa188d9 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:10915
0xacd6f6 complete_type(tree_node*)
        ../../gcc/cp/typeck.c:136
0xa78500 lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
        ../../gcc/cp/search.c:1116
0x97e25e lookup_qualified_name(tree_node*, tree_node*, int, bool, bool)
        ../../gcc/cp/name-lookup.c:5588
0xa2a02b tsubst_qualified_id
        ../../gcc/cp/pt.c:14571
0xa3a11a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/cp/pt.c:17345
0xa37959 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/cp/pt.c:16779
0xa18983 tsubst_template_arg
        ../../gcc/cp/pt.c:10933
0xa1bb45 tsubst_template_args
        ../../gcc/cp/pt.c:11801
0xa1c7cd tsubst_aggr_type
        ../../gcc/cp/pt.c:12003
0xa26349 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.c:13645
0xa18947 tsubst_template_arg
        ../../gcc/cp/pt.c:10928
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The ICE is in the same spot as PR81917, but has regressed in a different
revision, so no idea if the two are related or not.

Reply via email to