re PR c++/51429 (ICE with invalid use of overloaded member function)

PR c++/51429
	* typeck2.c (cxx_incomplete_type_diagnostic): Don't
	ICE if TREE_OPERAND (value, 1) is overloaded.

	* g++.dg/parse/error45.C: New test.

From-SVN: r182089
This commit is contained in:
Jakub Jelinek 2011-12-07 21:46:38 +01:00 committed by Jakub Jelinek
parent 6f8e335e64
commit ff180d72d9
4 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,9 @@
2011-12-07 Jakub Jelinek <jakub@redhat.com>
PR c++/51429
* typeck2.c (cxx_incomplete_type_diagnostic): Don't
ICE if TREE_OPERAND (value, 1) is overloaded.
PR c++/51229
* decl.c (reshape_init_class): Complain if d->cur->index is
INTEGER_CST.

View File

@ -428,15 +428,20 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
case OFFSET_TYPE:
bad_member:
if (DECL_FUNCTION_MEMBER_P (TREE_OPERAND (value, 1))
&& ! flag_ms_extensions)
emit_diagnostic (diag_kind, input_location, 0,
"invalid use of member function "
"(did you forget the %<()%> ?)");
else
emit_diagnostic (diag_kind, input_location, 0,
"invalid use of member "
"(did you forget the %<&%> ?)");
{
tree member = TREE_OPERAND (value, 1);
if (is_overloaded_fn (member))
member = get_first_fn (member);
if (DECL_FUNCTION_MEMBER_P (member)
&& ! flag_ms_extensions)
emit_diagnostic (diag_kind, input_location, 0,
"invalid use of member function "
"(did you forget the %<()%> ?)");
else
emit_diagnostic (diag_kind, input_location, 0,
"invalid use of member "
"(did you forget the %<&%> ?)");
}
break;
case TEMPLATE_TYPE_PARM:

View File

@ -1,5 +1,8 @@
2011-12-07 Jakub Jelinek <jakub@redhat.com>
PR c++/51429
* g++.dg/parse/error45.C: New test.
PR c++/51229
* g++.dg/ext/desig3.C: New test.

View File

@ -0,0 +1,9 @@
// PR c++/51429
// { dg-do compile }
struct A
{
void foo (double);
void foo (int);
A () { foo = 0; } // { dg-error "invalid use of member function" }
};