http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58761

--- Comment #2 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Reduced:

template <class T>
struct X
{
  int x = 42;
  int y = [this](){return this->x;}();
};

int main()
{
  X<int> x;
}


Seems to require a template to trigger, but from that point onwards,
it's quite easy to trigger. Including the trace just in case it's
somehow different:

twosided_reduced.cpp: In instantiation of ‘struct X<int>::<lambda()>’:
twosided_reduced.cpp:5:37:   required from here
twosided_reduced.cpp:5:12: internal compiler error: in tsubst_copy, at
cp/pt.c:12344
   int y = [this](){return this->x;}();
            ^
0x5ab2e8 tsubst_copy
    ../../gcc/cp/pt.c:12344
0x585cab tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:14921
0x5873bb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:13987
0x585e15 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:14693
0x5c8ada instantiate_class_template_1
    ../../gcc/cp/pt.c:9181
0x5c8ada instantiate_class_template(tree_node*)
    ../../gcc/cp/pt.c:9239
0x659f7b complete_type(tree_node*)
    ../../gcc/cp/typeck.c:132
0x586c75 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:15018
0x5876c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
    ../../gcc/cp/pt.c:14415
0x68a0e6 perform_member_init
    ../../gcc/cp/init.c:538
0x68a0e6 emit_mem_initializers(tree_node*)
    ../../gcc/cp/init.c:1096
0x69481e synthesize_method(tree_node*)
    ../../gcc/cp/method.c:796
0x605be9 mark_used(tree_node*, int)
    ../../gcc/cp/decl2.c:4778
0x534926 build_over_call
    ../../gcc/cp/call.c:7116
0x53071e build_new_method_call_1
    ../../gcc/cp/call.c:7813
0x53071e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
    ../../gcc/cp/call.c:7883
0x531692 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
    ../../gcc/cp/call.c:7440
0x686417 expand_default_init
    ../../gcc/cp/init.c:1668
0x686417 expand_aggr_init_1
    ../../gcc/cp/init.c:1769
0x688fe9 build_aggr_init(tree_node*, tree_node*, int, int)
    ../../gcc/cp/init.c:1520
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to