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

            Bug ID: 71638
           Summary: ICE on x86_64-linux-gnu with -Wall (internal compiler
                    error: non-constant element in constant CONSTRUCTOR)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$: g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160623 (experimental) [trunk revision 237733] (GCC) 
$: 
$: g++-trunk -Wall small.C
small.C:3:13: error: invalid conversion from ‘A::<anonymous struct>*’ to ‘int’
[-fpermissive]
     int j = this;
             ^~~~
small.C: In function ‘void f(A)’:
small.C:9:8: internal compiler error: non-constant element in constant
CONSTRUCTOR
   f(A{});
        ^
0x103f5bb verify_constructor_flags(tree_node*)
        ../../gcc-source-trunk/gcc/tree.c:1830
0x8aac29 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3945
0x8aad18 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4092
0x8ab4ce cxx_eval_indirect_ref
        ../../gcc-source-trunk/gcc/cp/constexpr.c:2944
0x8ab4ce cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3771
0x8af369 cxx_eval_component_reference
        ../../gcc-source-trunk/gcc/cp/constexpr.c:2153
0x8ab7a8 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3923
0x8af369 cxx_eval_component_reference
        ../../gcc-source-trunk/gcc/cp/constexpr.c:2153
0x8ab7a8 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3923
0x8b0074 cxx_eval_bare_aggregate
        ../../gcc-source-trunk/gcc/cp/constexpr.c:2485
0x8aac62 cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3952
0x8ab28c cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3694
0x8aadfa cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3779
0x8aa86b cxx_eval_constant_expression
        ../../gcc-source-trunk/gcc/cp/constexpr.c:3981
0x8b1419 cxx_eval_outermost_constant_expr
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4211
0x8b4278 maybe_constant_value_1
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4405
0x8b4278 maybe_constant_value(tree_node*, tree_node*)
        ../../gcc-source-trunk/gcc/cp/constexpr.c:4429
0x66bcf2 build_over_call
        ../../gcc-source-trunk/gcc/cp/call.c:7648
0x6778d1 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8515
0x6778d1 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ../../gcc-source-trunk/gcc/cp/call.c:8585
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.
$: 
$: cat small.C
struct A {
  struct {
    int j = this;
  } b;
  int a = b.j;
};

void f(A) { 
  f(A{}); 
}

Reply via email to