Commit b4cb0e43 by Andrew MacLeod Committed by Andrew Macleod

pr17400.C: New testcase.


2004-09-13  Andrew MacLeod  <amacleod@redhat.com>

	* g++.dg/tree-ssa/pr17400.C: New testcase.

From-SVN: r87449
parent 88ed5ef5
2004-09-13 Andrew MacLeod <amacleod@redhat.com>
* g++.dg/tree-ssa/pr17400.C: New testcase.
2004-09-13 James E Wilson <wilson@specifixinc.com>
* gcc.target/mips/sb1-1.c: New testcase.
......
// Test PR 17400. Test case provided by Serge Belyshev.
/* { dg-do compile } */
/* { dg-options "-O1" } */
void inc (int &);
bool dec_test (int &);
struct A
{
int c;
friend void AddRef (A * p)
{
inc (p->c);
}
friend void Release (A * p)
{
if(dec_test (p->c))
delete p;
}
};
struct B
{
B (A *p) : obj(p)
{
AddRef (obj);
}
~B()
{
Release (obj);
}
void swap (B &rhs)
{
A * tmp = obj;
obj = rhs.obj;
rhs.obj = tmp;
}
A *obj;
};
void bar (A *p1, A* p2)
{
B px (p1);
B px2 (p2);
px.swap (px2);
}
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