diff options
author | Mark Mitchell <mark@codesourcery.com> | 1999-04-16 18:06:34 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1999-04-16 18:06:34 +0000 |
commit | 78638e240e2d91aa5d0cad91b49e82dae74d6a7c (patch) | |
tree | 96f46bb5c5b9a1ba431ad60b014954d8bb972fad | |
parent | 4d1bb6125f6d292168dd258afc4d907e1118de2b (diff) | |
download | gcc-78638e240e2d91aa5d0cad91b49e82dae74d6a7c.zip gcc-78638e240e2d91aa5d0cad91b49e82dae74d6a7c.tar.gz gcc-78638e240e2d91aa5d0cad91b49e82dae74d6a7c.tar.bz2 |
class.c (finish_struct): Remove unused variable.
* class.c (finish_struct): Remove unused variable.
(pushclass): Likewise.
(invalidate_class_lookup_cache): Likewise.
* cp-tree.def (TYPENAME_TYPE): Improve documentation.
* decl.c (build_typename_type): Make sure TYPENAME_TYPE_FULLNAME
doesn't get obliterated.
(make_typename_type): Handle template classes correctly.
From-SVN: r26507
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.def | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/typename22.C | 17 |
5 files changed, 46 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b7b3a85..67cc7e1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,13 @@ 1999-04-16 Mark Mitchell <mark@codesourcery.com> + * class.c (finish_struct): Remove unused variable. + (pushclass): Likewise. + (invalidate_class_lookup_cache): Likewise. + * cp-tree.def (TYPENAME_TYPE): Improve documentation. + * decl.c (build_typename_type): Make sure TYPENAME_TYPE_FULLNAME + doesn't get obliterated. + (make_typename_type): Handle template classes correctly. + * cp-tree.h (TREE_NONLOCAL_FLAG): Remove. (storetags): Declare. * class.c (finish_struct): Don't use TREE_NONLOCAL_FLAG. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index cc23b29..ac762b5 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4160,7 +4160,6 @@ finish_struct (t, attributes, warn_anon) int warn_anon; { tree name = TYPE_NAME (t); - tree x; if (TREE_CODE (name) == TYPE_DECL) { @@ -4481,8 +4480,6 @@ pushclass (type, modify) if (modify) { - tree tags; - if (type != previous_class_type || current_class_depth > 1) push_class_decls (type); else @@ -4519,7 +4516,6 @@ pushclass (type, modify) void invalidate_class_lookup_cache () { - tree tags = CLASSTYPE_TAGS (previous_class_type); tree t; /* This code can be seen as a cache miss. When we've cached a diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index 090d837..da0f164 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -144,9 +144,11 @@ DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0) DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0) /* A type designated by `typename T::t'. TYPE_CONTEXT is `T', - TYPE_NAME is a TYPE_DECL for `t'. If TREE_TYPE is present, this - type was generated by the implicit typename extension, and the - TREE_TYPE is a _TYPE from a baseclass of `T'. */ + TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via + template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR. + If TREE_TYPE is present, this type was generated by the implicit + typename extension, and the TREE_TYPE is a _TYPE from a baseclass + of `T'. */ DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0) /* A type designated by `__typeof (expr)'. TYPE_FIELDS is the diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d1f722c..5730719 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5302,6 +5302,11 @@ build_typename_type (context, name, fullname, base_type) &typename_compare)) fatal ("virtual memory exhausted"); + /* The FULLNAME needs to exist for the life of the hash table, i.e., + for the entire compilation. */ + if (!TREE_PERMANENT (fullname)) + fullname = copy_to_permanent (fullname); + /* Build the TYPENAME_TYPE. */ t = make_lang_type (TYPENAME_TYPE); TYPE_CONTEXT (t) = FROB_CONTEXT (context); @@ -5341,7 +5346,17 @@ make_typename_type (context, name) tree fullname; if (TREE_CODE_CLASS (TREE_CODE (name)) == 't') - name = TYPE_IDENTIFIER (name); + { + if (!(TYPE_LANG_SPECIFIC (name) + && (CLASSTYPE_IS_TEMPLATE (name) + || CLASSTYPE_USE_TEMPLATE (name)))) + name = TYPE_IDENTIFIER (name); + else + /* Create a TEMPLATE_ID_EXPR for the type. */ + name = build_nt (TEMPLATE_ID_EXPR, + CLASSTYPE_TI_TEMPLATE (name), + CLASSTYPE_TI_ARGS (name)); + } else if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename22.C b/gcc/testsuite/g++.old-deja/g++.pt/typename22.C new file mode 100644 index 0000000..86a82df --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename22.C @@ -0,0 +1,17 @@ +// Build don't link: +// Origin: Mark Mitchell <mark@codesourcery.com> + +template <class T> +struct S { + template <class U> + struct I { + typedef U X; + + X f(); + }; +}; + + +template <class T> +template <class U> +typename S<T>::I<U>::X S<T>::I<U>::f() {} |