aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/rtti/typeid4.C
blob: e6a1dce16f0e938cdf8fe748575f2f1a40135828 (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
// { dg-do run }
// { dg-options "-O2" }

#include <typeinfo>
#include <iostream>

struct A { virtual ~A () {} };

struct APtr
{ 
  APtr (A* p)  : p_ (p) { }
  A& operator* () const { return *p_; }
  A* p_;
};

int main ()
{ 
  APtr ap (new A);
  std::type_info const* const exp = &typeid (*ap);
  for (bool cont = true; cont; cont = false)
    { 
      std::cout << "inner: cont " << cont << std::endl;
      if (exp) ;
    }
}