https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71835
Bug ID: 71835 Summary: ICE on invalid C++ code with ambiguous overloaded operators: tree check: expected tree that contains ‘decl minimal’ structure, have ‘pointer_type’ in convert_like_real, at cp/call.c:6549 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 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It also affects 6.1.x and is a regression from 5.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 20160710 (experimental) [trunk revision 238196] (GCC) $ $ g++-5.4 -c small.cpp small.cpp: In function ‘void f()’: small.cpp:7:18: error: conversion from ‘C’ to ‘void (*)(int)’ is ambiguous void f () { c (0); } ^ small.cpp:4:13: note: candidate: B::operator void (*)(int)() struct B { operator T * (); }; ^ small.cpp:3:13: note: candidate: A::operator void (*)(int)() struct A { operator T * (); }; ^ small.cpp:7:18: note: initializing argument 'this' of ‘#‘pointer_type’ not supported by dump_decl#<declaration error>’ void f () { c (0); } ^ $ $ g++-trunk -c small.cpp small.cpp: In function ‘void f()’: small.cpp:7:18: error: conversion from ‘C’ to ‘void (*)(int)’ is ambiguous void f () { c (0); } ^ small.cpp:4:13: note: candidate: B::operator void (*)(int)() struct B { operator T * (); }; ^~~~~~~~ small.cpp:3:13: note: candidate: A::operator void (*)(int)() struct A { operator T * (); }; ^~~~~~~~ small.cpp:7:18: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘pointer_type’ in convert_like_real, at cp/call.c:6549 void f () { c (0); } ^ 0x1060764 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9923 0x66de61 contains_struct_check ../../gcc-source-trunk/gcc/tree.h:3144 0x66de61 convert_like_real ../../gcc-source-trunk/gcc/cp/call.c:6549 0x67ab14 build_op_call_1 ../../gcc-source-trunk/gcc/cp/call.c:4410 0x67ab14 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc-source-trunk/gcc/cp/call.c:4429 0x8185c7 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc-source-trunk/gcc/cp/semantics.c:2450 0x791430 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6909 0x79a68c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:7991 0x79aee7 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8668 0x79b4e5 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8770 0x79bdd0 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9058 0x79e6c9 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9225 0x79ee3f cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10686 0x78cc7b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10537 0x78d93c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10809 0x78da2f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10763 0x7ac2cf cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20701 0x7ac2cf cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20737 0x7acd71 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25433 0x7ada85 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25345 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. $ ---------------------------------------- typedef void T (int); struct A { operator T * (); }; struct B { operator T * (); }; struct C : A, B {} c; void f () { c (0); }