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