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

            Bug ID: 84606
           Summary: internal compiler error: Segmentation fault
                    (enclosing_instantiation_of())
           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
  Target Milestone: ---

Input:

template<typename>
struct s {
  struct {
    void __attribute__((common([] { struct d }))) g();
  } f;
};

s<int> a {};

Output:

$ xgcc -x c++ -std=c++14 -O3 -c -
<stdin>: In lambda function:
<stdin>:4:46: error: expected unqualified-id before '}' token
<stdin>: In instantiation of 'struct s<int>::<unnamed>':
<stdin>:5:5:   required from 'struct s<int>'
<stdin>:8:8:   required from here
<stdin>:4:33: internal compiler error: Segmentation fault
0x3138779 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0x104b080 enclosing_instantiation_of
        /home/vegard/git/gcc/gcc/cp/pt.c:12691
0x117abb3 tsubst_function_decl
        /home/vegard/git/gcc/gcc/cp/pt.c:12245
0x11514e5 tsubst_decl
        /home/vegard/git/gcc/gcc/cp/pt.c:12729
0x11034de tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/vegard/git/gcc/gcc/cp/pt.c:13624
0x1164e71 lookup_template_class_1
        /home/vegard/git/gcc/gcc/cp/pt.c:8893
0x1174dce lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/vegard/git/gcc/gcc/cp/pt.c:9168
0x1174dce tsubst_aggr_type
        /home/vegard/git/gcc/gcc/cp/pt.c:12074
0x1104a1d tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/vegard/git/gcc/gcc/cp/pt.c:13707
0x1155593 tsubst_decl
        /home/vegard/git/gcc/gcc/cp/pt.c:13003
0x11034de tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/vegard/git/gcc/gcc/cp/pt.c:13624
0x10c53d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:16118
0x10ba0da tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:16322
0x10ba0da tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:16322
0x11d759b tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        /home/vegard/git/gcc/gcc/cp/pt.c:17057
0x10f3373 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:18346
0x10f1376 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:18027
0x10bb79c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/vegard/git/gcc/gcc/cp/pt.c:16838
0x116144f tsubst_attribute
        /home/vegard/git/gcc/gcc/cp/pt.c:10172
0x1171600 apply_late_template_attributes
        /home/vegard/git/gcc/gcc/cp/pt.c:10274


Version:

xgcc (GCC) 8.0.1 20180204 (experimental)

built from git fdae6180ad24fa6303fa046114f3e4b66b8db34d

Version 7.3.0 don't seem to be affected AFAICS.

Test case was reduced by C-Reduce.

Reply via email to