aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/rtti/typeid4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/rtti/typeid4.C')
-rw-r--r--gcc/testsuite/g++.dg/rtti/typeid4.C26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/rtti/typeid4.C b/gcc/testsuite/g++.dg/rtti/typeid4.C
new file mode 100644
index 00000000000..e6a1dce16f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/typeid4.C
@@ -0,0 +1,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) ;
+ }
+}
+