http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57948
Bug ID: 57948
Summary: internal compiler error: in initialize_reference, at
cp/call.c:9285
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cas43 at cs dot stanford.edu
With this input:
struct Base { };
struct Derived : Base
{
struct Derived2 : Base
{
struct ConvertibleToBothDerivedRef
{
operator Derived&();
operator Derived2&();
void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef
both)
{
Base &br1 = both;
}
};
};
};
compiled like this: g++ prog.cpp
I get this output:
prog.cpp: In member function ‘void
Derived::Derived2::ConvertibleToBothDerivedRef::bind_lvalue_to_conv_lvalue_ambig(Derived::Derived2::ConvertibleToBothDerivedRef)’:
prog.cpp:12:29: error: conversion from
‘Derived::Derived2::ConvertibleToBothDerivedRef’ to ‘Base&’ is ambiguous
Base &br1 = both;
^
prog.cpp:10:18: note: candidates are:
void bind_lvalue_to_conv_lvalue_ambig(ConvertibleToBothDerivedRef
both)
^
prog.cpp:9:13: note: Derived::Derived2::ConvertibleToBothDerivedRef::operator
Derived::Derived2&()
operator Derived2&();
^
prog.cpp:8:13: note: Derived::Derived2::ConvertibleToBothDerivedRef::operator
Derived&()
operator Derived&();
^
prog.cpp:12:29: internal compiler error: in initialize_reference, at
cp/call.c:9285
Base &br1 = both;
^
0x52061e initialize_reference(tree_node*, tree_node*, int, int)
../../s-4.9/gcc/cp/call.c:9285
0x52d9a4 grok_reference_init
../../s-4.9/gcc/cp/decl.c:4762
0x52d9a4 check_initializer
../../s-4.9/gcc/cp/decl.c:5630
0x54006d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../s-4.9/gcc/cp/decl.c:6349
0x6260fd cp_parser_init_declarator
../../s-4.9/gcc/cp/parser.c:16527
0x62673e cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10946
0x6285a0 cp_parser_block_declaration
../../s-4.9/gcc/cp/parser.c:10827
0x6296a0 cp_parser_declaration_statement
../../s-4.9/gcc/cp/parser.c:10471
0x612527 cp_parser_statement
../../s-4.9/gcc/cp/parser.c:9229
0x61382e cp_parser_statement_seq_opt
../../s-4.9/gcc/cp/parser.c:9509
0x613976 cp_parser_compound_statement
../../s-4.9/gcc/cp/parser.c:9463
0x624733 cp_parser_function_body
../../s-4.9/gcc/cp/parser.c:18257
0x624733 cp_parser_ctor_initializer_opt_and_function_body
../../s-4.9/gcc/cp/parser.c:18293
0x62578f cp_parser_function_definition_after_declarator
../../s-4.9/gcc/cp/parser.c:22271
0x60b49c cp_parser_late_parsing_for_member
../../s-4.9/gcc/cp/parser.c:22923
0x60b49c cp_parser_class_specifier_1
../../s-4.9/gcc/cp/parser.c:19016
0x60d610 cp_parser_class_specifier
../../s-4.9/gcc/cp/parser.c:19040
0x60d610 cp_parser_type_specifier
../../s-4.9/gcc/cp/parser.c:14042
0x622ad9 cp_parser_decl_specifier_seq
../../s-4.9/gcc/cp/parser.c:11288
0x626599 cp_parser_simple_declaration
../../s-4.9/gcc/cp/parser.c:10878
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.
Compiler version:
Using built-in specs.
COLLECT_GCC=/home/craig/new-gcc/i-4.9/bin/g++
COLLECT_LTO_WRAPPER=/home/craig/new-gcc/i-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.9/configure --prefix=/home/craig/new-gcc/i-4.9
Thread model: posix
gcc version 4.9.0 20130718 (experimental) (GCC)