* g++.dg/opt/rtti1.C: New test.
authorJakub Jelinek <jakub@redhat.com>
Mon, 24 Mar 2003 11:36:26 +0000 (12:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 24 Mar 2003 11:36:26 +0000 (12:36 +0100)
From-SVN: r64788

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/rtti1.C [new file with mode: 0644]

index d5fbd91..25027a9 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-24  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/opt/rtti1.C: New test.
+
 2003-03-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.dg/ultrasp5.c: New test.
diff --git a/gcc/testsuite/g++.dg/opt/rtti1.C b/gcc/testsuite/g++.dg/opt/rtti1.C
new file mode 100644 (file)
index 0000000..32daaef
--- /dev/null
@@ -0,0 +1,20 @@
+// Test that typeid sees through references even when optimizing.
+// { dg-do run }
+// { dg-options "-O2" }
+
+#include <typeinfo>
+
+struct A
+{
+  virtual ~A() { }
+};
+
+class B : public A { };
+
+int main ()
+{
+  B b;
+  A &aref = b;
+
+  return typeid (aref) != typeid (b);
+}