| 1 |
// { dg-do run } |
| 2 |
// { dg-options "-O2" } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } } |
| 4 |
|
| 5 |
#include <typeinfo> |
| 6 |
#include <iostream> |
| 7 |
|
| 8 |
struct A { virtual ~A () {} }; |
| 9 |
|
| 10 |
struct APtr |
| 11 |
{ |
| 12 |
APtr (A* p) : p_ (p) { } |
| 13 |
A& operator* () const { return *p_; } |
| 14 |
A* p_; |
| 15 |
}; |
| 16 |
|
| 17 |
int main () |
| 18 |
{ |
| 19 |
APtr ap (new A); |
| 20 |
std::type_info const* const exp = &typeid (*ap); |
| 21 |
for (bool cont = true; cont; cont = false) |
| 22 |
{ |
| 23 |
std::cout << "inner: cont " << cont << std::endl; |
| 24 |
if (exp) ; |
| 25 |
} |
| 26 |
} |
| 27 |
|