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

            Bug ID: 84720
           Summary: internal compiler error: tree check: expected tree
                    that contains 'decl minimal' structure, have
                    'error_mark' in decl_anon_ns_mem_p, at cp/tree.c:3472
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

template<int &&>
struct a {
  template<typename...>
  static void b() {
    b();
  }
};

Output:

$ xgcc -x c++ -S -
<stdin>: In substitution of 'template<int&& <anonymous> > template<class ...>
static void a<<anonymous> >::b() [with <template-parameter-2-1> = <missing>;
int&& <anonymous> = {}]':
<stdin>:5:7:   required from here
<stdin>:4:15: internal compiler error: tree check: expected tree that contains
'decl minimal' structure, have 'error_mark' in decl_anon_ns_mem_p, at
cp/tree.c:3472
0x66106d tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        /home/vegard/git/gcc/gcc/tree.c:9509
0x131d185 contains_struct_check(tree_node const*, tree_node_structure_enum,
char const*, int, char const*)
        /home/vegard/git/gcc/gcc/tree.h:3502
0x131d185 decl_anon_ns_mem_p(tree_node const*)
        /home/vegard/git/gcc/gcc/cp/tree.c:3472
0xc3288f determine_visibility(tree_node*)
        /home/vegard/git/gcc/gcc/cp/decl2.c:2537
0x117fa53 tsubst_function_decl
        /home/vegard/git/gcc/gcc/cp/pt.c:12692
0x1156895 tsubst_decl
        /home/vegard/git/gcc/gcc/cp/pt.c:12921
0x11071d6 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/vegard/git/gcc/gcc/cp/pt.c:13809
0x1121474 instantiate_template_1
        /home/vegard/git/gcc/gcc/cp/pt.c:18784
0x112423e instantiate_template(tree_node*, tree_node*, int)
        /home/vegard/git/gcc/gcc/cp/pt.c:18840
0x119d32b fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:19220
0x907d89 add_template_candidate_real
        /home/vegard/git/gcc/gcc/cp/call.c:3180
0x90af6c add_template_candidate
        /home/vegard/git/gcc/gcc/cp/call.c:3258
0x90af6c add_candidates
        /home/vegard/git/gcc/gcc/cp/call.c:5525
0x93bdea build_new_method_call_1
        /home/vegard/git/gcc/gcc/cp/call.c:9154
0x93bdea build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/call.c:9361
0x12802c0 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        /home/vegard/git/gcc/gcc/cp/semantics.c:2450
0xf7bb98 cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:7244
0xf2e927 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8320
0xec435a cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9088
0xec6986 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9189

$ xgcc --version
xgcc (GCC) 8.0.1 20180303 (experimental)

Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221).

Seems to have been introduced between 6.3.0 and 7.1.0 (as it actually compiles
with 6.3.0). It also seems to compile with clang. 

ICE message looks similar to bug #84694 but I have it on good authority that
it's a different bug :-)

Test case was minimised by C-Reduce.

Reply via email to