Commit c93586fa by Richard Sandiford Committed by Jason Merrill

except.c (initialize_handler_parm): Expect __cxa_begin_catch to return pointers…

except.c (initialize_handler_parm): Expect __cxa_begin_catch to return pointers to data members by reference rather...

        * except.c (initialize_handler_parm): Expect __cxa_begin_catch to
        return pointers to data members by reference rather than by value.

From-SVN: r43456
parent a0d4ddde
2001-06-19 Richard Sandiford <rsandifo@redhat.com>
* except.c (initialize_handler_parm): Expect __cxa_begin_catch to
return pointers to data members by reference rather than by value.
2001-06-18 Jason Merrill <jason_merrill@redhat.com>
Implement the Named Return Value optimization.
......
......@@ -348,7 +348,7 @@ initialize_handler_parm (decl, exp)
adjusted by value from __cxa_begin_catch. Others are returned by
reference. */
init_type = TREE_TYPE (decl);
if (TREE_CODE (init_type) != POINTER_TYPE
if (! TYPE_PTR_P (init_type)
&& TREE_CODE (init_type) != REFERENCE_TYPE)
init_type = build_reference_type (init_type);
......@@ -357,8 +357,8 @@ initialize_handler_parm (decl, exp)
/* Since pointers are passed by value, initialize a reference to
pointer catch parm with the address of the temporary. */
if (TREE_CODE (init_type) == REFERENCE_TYPE
&& TREE_CODE (TREE_TYPE (init_type)) == POINTER_TYPE)
if (TREE_CODE (init_type) == REFERENCE_TYPE
&& TYPE_PTR_P (TREE_TYPE (init_type)))
exp = build_unary_op (ADDR_EXPR, exp, 1);
exp = ocp_convert (init_type, exp, CONV_IMPLICIT|CONV_FORCE_TEMP, 0);
......
extern "C" void exit (int);
extern "C" void abort (void);
struct A { int i; };
int main ()
{
try { throw &A::i; }
catch (int A::*p)
{
if (p == &A::i)
exit (0);
else
abort ();
}
abort ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment