re PR c++/20817 (ICE for tree check in build_offset_type)

cp:
	PR c++/20817
	* typeck.c (build_x_unary_op): Make sure OFFSET_REF is not for a
	->*.
testsuite:
	PR c++/20817
	* g++.old-deja/g++.benjamin/13908.C: Robustify expected error.

From-SVN: r103481
This commit is contained in:
Nathan Sidwell 2005-08-25 09:06:45 +00:00 committed by Nathan Sidwell
parent 9ebbe8cc17
commit 5ebbc0ee56
4 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2005-08-25 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20817
* typeck.c (build_x_unary_op): Make sure OFFSET_REF is not for a
->*.
2005-08-24 Nathan Sidwell <nathan@codesourcery.com>
PR c++/22454

View File

@ -3615,11 +3615,13 @@ build_x_unary_op (enum tree_code code, tree xarg)
if (!flag_ms_extensions && TREE_CODE (TREE_TYPE (xarg)) == METHOD_TYPE
&& (TREE_CODE (xarg) != OFFSET_REF || !PTRMEM_OK_P (xarg)))
{
if (TREE_CODE (xarg) != OFFSET_REF)
if (TREE_CODE (xarg) != OFFSET_REF
|| !TYPE_P (TREE_OPERAND (xarg, 0)))
{
error ("invalid use of %qE to form a pointer-to-member-function."
" Use a qualified-id.",
error ("invalid use of %qE to form a pointer-to-member-function",
xarg);
if (TREE_CODE (xarg) != OFFSET_REF)
inform (" a qualified-id is required");
return error_mark_node;
}
else

View File

@ -1,3 +1,8 @@
2005-08-25 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20817
* g++.old-deja/g++.benjamin/13908.C: Robustify expected error.
2005-08-25 Alan Modra <amodra@bigpond.net.au>
* gcc.dg/vect/vect-52.c: Increase b[] and c[] size by one.

View File

@ -17,5 +17,5 @@ void bar (chile* pobj, pmf pmethod)
{
//-edg: expected member name
//-g++: taking address of bound pointer-to-member expression
foo = (void*) &(pobj->*pmethod); // { dg-error "" }
foo = (void*) &(pobj->*pmethod); // { dg-error "invalid use" }
}