re PR c++/2521 (ICE in build_ptrmemfunc, at cp/typeck.c:6087)

PR C++/2521
        * typeck.c (build_x_unary_op): Handle pointer-to-member.

From-SVN: r58714
This commit is contained in:
Gabriel Dos Reis 2002-11-01 13:12:24 +00:00 committed by Gabriel Dos Reis
parent 9697839bb4
commit 04cbc98101
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-11-01 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR C++/2521
* typeck.c (build_x_unary_op): Handle pointer-to-member.
2002-10-30 Mark Mitchell <mark@codesourcery.com>
PR c++/8160

View File

@ -4167,6 +4167,25 @@ build_x_unary_op (code, xarg)
}
if (code == ADDR_EXPR)
{
/* A pointer to member-function can be formed only by saying
&X::mf. */
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)
{
error ("invalid use of '%E' to form a pointer-to-member-function. Use a qualified-id.",
xarg);
return error_mark_node;
}
else
{
error ("parenthesis around '%E' cannot be used to form a pointer-to-member-function",
xarg);
PTRMEM_OK_P (xarg) = 1;
}
}
if (TREE_CODE (xarg) == OFFSET_REF)
{
ptrmem = PTRMEM_OK_P (xarg);