summaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-01 20:27:37 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2002-12-01 20:27:37 +0000
commitd085a8479fa3ca78beb178f93079ef58da3c2d0d (patch)
tree949e579a2127ed5b717cc2f0c87ffab7e3cf700e /gcc/cp/rtti.c
parent9363c37324826dda40e07ef99fd64422c365b7f5 (diff)
downloadgcc-d085a8479fa3ca78beb178f93079ef58da3c2d0d.tar.gz
PR c++/8727
* g++.dg/inherit/typeinfo1.C: New test. PR c++/8663 * g++.dg/inherit/typedef1.C: New test. PR c++/8727 * cp-tree.h (lang_type_class): Add typeinfo_var. (CLASSTYPE_TYPEINFO_VAR): New macro. * rtti.c (get_tinfo_decl): Use it. PR c++/8663 * init.c (expand_member_init): Always get the main variant of a base class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59694 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 17942c30fd6..7540b5c0e72 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -328,6 +328,15 @@ get_tinfo_decl (type)
type = build_function_type (TREE_TYPE (type),
TREE_CHAIN (TYPE_ARG_TYPES (type)));
+ /* For a class type, the variable is cached in the type node
+ itself. */
+ if (CLASS_TYPE_P (type))
+ {
+ d = CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type));
+ if (d)
+ return d;
+ }
+
name = mangle_typeinfo_for_type (type);
d = IDENTIFIER_GLOBAL_VALUE (name);
@@ -347,6 +356,9 @@ get_tinfo_decl (type)
pushdecl_top_level (d);
+ if (CLASS_TYPE_P (type))
+ CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d;
+
/* Remember the type it is for. */
TREE_TYPE (name) = type;
}