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

            Bug ID: 71979
           Summary: ICE with on C++ code with incorrect type in overloaded
                    base class '=' operator: in build_base_path, at
                    cp/class.c:304
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following C++ code causes an ICE when compiled with the current GCC trunk
with -std=c++11 on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

This also affects 5.x and 6.x, and is a regression from 4.9.x. 


$ 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 20160722 (experimental) [trunk revision 238631] (GCC)
$
$ g++-trunk -c -std=c++11 small.cpp
small.cpp: In function ‘void foo()’:
small.cpp:14:10: error: use of deleted function ‘B& B::operator=(B&&)’
   b = B ();
          ^
small.cpp:9:8: note: ‘B& B::operator=(B&&)’ is implicitly deleted because the
default definition would be ill-formed:
 struct B : A {};
        ^
small.cpp:9:8: internal compiler error: in build_base_path, at cp/class.c:304
0x7307d9 build_base_path(tree_code, tree_node*, tree_node*, int, int)
        ../../gcc-source-trunk/gcc/cp/class.c:304
0x643b81 build_over_call
        ../../gcc-source-trunk/gcc/cp/call.c:7503
0x64fdf1 build_new_method_call_1
        ../../gcc-source-trunk/gcc/cp/call.c:8532
0x64fdf1 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:8602
0x7dbf54 locate_fn_flags
        ../../gcc-source-trunk/gcc/cp/method.c:920
0x7dcf41 synthesized_method_walk
        ../../gcc-source-trunk/gcc/cp/method.c:1493
0x7e2300 maybe_explain_implicit_delete(tree_node*)
        ../../gcc-source-trunk/gcc/cp/method.c:1676
0x740420 mark_used(tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/decl2.c:5147
0x643fe0 build_over_call
        ../../gcc-source-trunk/gcc/cp/call.c:7812
0x656953 build_new_op_1
        ../../gcc-source-trunk/gcc/cp/call.c:5705
0x65703e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
        ../../gcc-source-trunk/gcc/cp/call.c:5904
0x7b7053 cp_build_modify_expr(unsigned int, tree_node*, tree_code, tree_node*,
int)
        ../../gcc-source-trunk/gcc/cp/typeck.c:7631
0x7b802c build_x_modify_expr(unsigned int, tree_node*, tree_code, tree_node*,
int)
        ../../gcc-source-trunk/gcc/cp/typeck.c:7872
0x779aa5 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9121
0x77c0d9 cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9246
0x77c84f cp_parser_expression_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10709
0x76a67b cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10560
0x76b33c cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:10832
0x76b42f cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:10786
0x789ccf cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:20743
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.
$


-----------------------------------------------


struct A
{ 
  // Should be: A & operator= (const A &);
  // or: A & operator= (A);
  // or: A & operator= (A &&);
  A & operator= (A &);
};

struct B : A {};

void foo ()
{ 
  B b;
  b = B ();
}

Reply via email to