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
This commit is contained in:
parent
c9d892a83f
commit
cd4e8331bd
4 changed files with 40 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
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>
|
||||
|
||||
* cp-lang.c (LANG_HOOKS_EXPAND_EXPR): Redefine.
|
||||
|
|
|
@ -3611,15 +3611,22 @@ build_op_delete_call (code, addr, size, flags, 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. */
|
||||
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. */
|
||||
argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes)));
|
||||
|
||||
argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
|
||||
/* Also the second argument. */
|
||||
args = TREE_CHAIN (TREE_OPERAND (placement, 1));
|
||||
args = TREE_CHAIN (TREE_OPERAND (call_expr, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2002-03-27 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* g++.dg/init/new2.C: New test.
|
||||
|
||||
2002-03-26 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* gcc.dg/pragma-re-2.c: Avoid empty source file warning.
|
||||
|
|
18
gcc/testsuite/g++.dg/init/new2.C
Normal file
18
gcc/testsuite/g++.dg/init/new2.C
Normal file
|
@ -0,0 +1,18 @@
|
|||
// 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;
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue