summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/pr24231-3.C
blob: a9ea58b1197e2b6f233a7c702e56a461a61ae775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* PRE testcase for PR 24231, problem with PRE coalescing abnormal phis.  */
struct MemoryManager {
      virtual void deallocate() = 0;
};
struct XalanVector {
      ~XalanVector()   {
	      m_memoryManager->deallocate();
	        }
        void swap(XalanVector& theOther)   {
	        MemoryManager* const theTempManager = m_memoryManager;
		    m_memoryManager = theOther.m_memoryManager;
		        theOther.m_memoryManager = theTempManager;
			    theOther.m_size = 0;
			      }
	  void push_back()   {
	          XalanVector theTemp(*this);
		      theTemp.push_back();
		          swap(theTemp);
			    }
	    MemoryManager* m_memoryManager;
	      int m_size;
};
void f(void) {
      XalanVector tempVector;
        tempVector.push_back();
}