From 17d208b54e0ff2ad5b0893457f53b27378baf77d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 30 Jun 2011 20:53:10 -0400 Subject: [PATCH] =?utf8?q?re=20PR=20c++/49387=20(t.cxx:140:=20error:=20too?= =?utf8?q?=20many=20initializers=20for=20=E2=80=98const=20=5F=5Fclass=5Fty?= =?utf8?q?pe=5Finfo=5Fpseudo=E2=80=99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR c++/49387 * rtti.c (get_pseudo_ti_index): Call complete_type. From-SVN: r175743 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/rtti.c | 2 ++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/rtti/template1.C | 23 +++++++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 gcc/testsuite/g++.dg/rtti/template1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e3f98455c37..ad6cd0355e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-06-30 Jason Merrill + 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. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 0feaf07f851..53404b4a62d 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 382e0981a70..7715ae0e32e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-06-30 Jason Merrill + 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 index 00000000000..e2a03766fbb --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/template1.C @@ -0,0 +1,23 @@ +// PR c++/49387 + +#include + +struct ResourceMonitorClient { }; + +template struct ResourcePool : public ResourceMonitorClient { + virtual ~ResourcePool() { } +}; + +template struct BaseWriter { + + BaseWriter() { + typeid(ResourcePool*); + } + + virtual void run() { + ResourcePool pool; + } + +}; + +BaseWriter b; -- 2.30.2