re PR c++/49387 (t.cxx:140: error: too many initializers for ‘const __class_type_info...
authorJason Merrill <jason@redhat.com>
Fri, 1 Jul 2011 00:53:10 +0000 (20:53 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 1 Jul 2011 00:53:10 +0000 (20:53 -0400)
PR c++/49387
* rtti.c (get_pseudo_ti_index): Call complete_type.

From-SVN: r175743

gcc/cp/ChangeLog
gcc/cp/rtti.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/rtti/template1.C [new file with mode: 0644]

index e3f98455c37c56977dcd06b7e5ff097d1bd181c3..ad6cd0355e1dd8a241520be77031e7e489fff7b9 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-30  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49387
+       * rtti.c (get_pseudo_ti_index): Call complete_type.
+
        PR c++/49569
        * method.c (implicitly_declare_fn): Set DECL_PARM_LEVEL and
        DECL_PARM_INDEX on rhs parm.
index 0feaf07f851ff2633688f5695f517731e67df30c..53404b4a62dc3293b7df7211bb867160c4609cef 100644 (file)
@@ -406,6 +406,8 @@ get_tinfo_decl (tree type)
     type = build_function_type (TREE_TYPE (type),
                                TREE_CHAIN (TYPE_ARG_TYPES (type)));
 
+  type = complete_type (type);
+
   /* For a class type, the variable is cached in the type node
      itself.  */
   if (CLASS_TYPE_P (type))
index 382e0981a707a83abba893a79f76035a8f52f97a..7715ae0e32e625b97a31a74c803271d2bc005176 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-30  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49387
+       * g++.dg/rtti/template1.C: New.
+
        PR c++/49569
        * g++.dg/cpp0x/regress/ctor1.C: New.
 
diff --git a/gcc/testsuite/g++.dg/rtti/template1.C b/gcc/testsuite/g++.dg/rtti/template1.C
new file mode 100644 (file)
index 0000000..e2a0376
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/49387
+
+#include <typeinfo>
+
+struct ResourceMonitorClient { };
+
+template <typename T> struct ResourcePool : public ResourceMonitorClient {
+  virtual ~ResourcePool() { }
+};
+
+template <typename T> struct BaseWriter {
+
+  BaseWriter() {
+    typeid(ResourcePool<int>*);
+  }
+
+  virtual void run() {
+    ResourcePool<int> pool;
+  }
+
+};
+
+BaseWriter<void> b;