Commit cd4e8331 by Mark Mitchell Committed by Mark Mitchell

re PR c++/4884 (g++ 3.0.2 problem with -fvolatile)

	* g++.dg/init/new2.C: New test.

	PR c++/4884
	* call.c (build_op_delete_call): Allow for the fact the placement
	may be a COMPOUND_EXPR.

From-SVN: r51466
parent c9d892a8
2002-03-27 Mark Mitchell <mark@codesourcery.com>
PR c++/4884
* call.c (build_op_delete_call): Allow for the fact the placement
may be a COMPOUND_EXPR.
2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk> 2002-03-27 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine. * cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
......
...@@ -3611,15 +3611,22 @@ build_op_delete_call (code, addr, size, flags, placement) ...@@ -3611,15 +3611,22 @@ build_op_delete_call (code, addr, size, flags, placement)
if (placement) if (placement)
{ {
/* placement is a CALL_EXPR around an ADDR_EXPR around a function. */ tree alloc_fn;
tree call_expr;
/* Find the allocation function that is being called. */
call_expr = placement;
/* Sometimes we have a COMPOUND_EXPR, rather than a simple
CALL_EXPR. */
while (TREE_CODE (call_expr) == COMPOUND_EXPR)
call_expr = TREE_OPERAND (call_expr, 1);
/* Extract the function. */ /* Extract the function. */
argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0); alloc_fn = get_callee_fndecl (call_expr);
my_friendly_assert (alloc_fn != NULL_TREE, 20020327);
/* Then the second parm type. */ /* Then the second parm type. */
argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes))); argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
/* Also the second argument. */ /* Also the second argument. */
args = TREE_CHAIN (TREE_OPERAND (placement, 1)); args = TREE_CHAIN (TREE_OPERAND (call_expr, 1));
} }
else else
{ {
......
2002-03-27 Mark Mitchell <mark@codesourcery.com>
* g++.dg/init/new2.C: New test.
2002-03-26 Richard Henderson <rth@redhat.com> 2002-03-26 Richard Henderson <rth@redhat.com>
* gcc.dg/pragma-re-2.c: Avoid empty source file warning. * gcc.dg/pragma-re-2.c: Avoid empty source file warning.
......
// Origin: asharji@uwaterloo.ca
// { dg-do compile }
// { dg-options "-fvolatile" }
class bar {
public :
bar() { }
void * operator new ( __SIZE_TYPE__ , void * storage )
{ return (void *)1;}
};
class foo {
public:
void mem ( ) {
new ( 0 ) bar;
}
};
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