commit 9e18be69b4b6177e94597a20b43ff42f8e8f33bb Author: Jason Merrill Date: Thu Jun 30 18:52:18 2011 -0400 PR c++/49387 * rtti.c (get_pseudo_ti_index): Call complete_type. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 0feaf07..53404b4 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/g++.dg/rtti/template1.C b/gcc/testsuite/g++.dg/rtti/template1.C new file mode 100644 index 0000000..e2a0376 --- /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;