diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-06 07:03:03 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-06 07:03:03 +0000 |
commit | bf2bb055454769099d15a11274f0f181d5da5b1d (patch) | |
tree | 998675f5fec8669765dfc87eb49169b66b42f636 /gcc/cp | |
parent | aec0af78841f3cfe3be228b10d8cb8606946ad03 (diff) | |
download | gcc-bf2bb055454769099d15a11274f0f181d5da5b1d.tar.gz |
* semantics.c (begin_class_definition): Robustify.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42937 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 25 |
2 files changed, 20 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7c0ebc5f754..829c4da9cba 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2001-06-05 Mark Mitchell <mark@codesourcery.com> + * semantics.c (begin_class_definition): Robustify. + * pt.c (instantiate_decl): Tell the repository code about the clones, not the cloned functions. * repo.c (repo_template_used): Explicitly instantiate the cloned diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b30c80e8c3d..f1a9e77aa7d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1724,18 +1724,29 @@ begin_class_definition (t) cp_error ("definition of `%#T' inside template parameter list", t); return error_mark_node; } - if (t == error_mark_node - || ! IS_AGGR_TYPE (t)) + + /* In a definition of a member class template, we will get here with + an implicit typename. */ + if (IMPLICIT_TYPENAME_P (t)) + t = TREE_TYPE (t); + /* A non-implicit typename comes from code like: + + template <typename T> struct A { + template <typename U> struct A<T>::B ... + + This is erroneous. */ + else if (TREE_CODE (t) == TYPENAME_TYPE) + { + cp_error ("invalid definition of qualified type `%T'", t); + t = error_mark_node; + } + + if (t == error_mark_node || ! IS_AGGR_TYPE (t)) { t = make_aggr_type (RECORD_TYPE); pushtag (make_anon_name (), t, 0); } - /* In a definition of a member class template, we will get here with an - implicit typename, a TYPENAME_TYPE with a type. */ - if (TREE_CODE (t) == TYPENAME_TYPE) - t = TREE_TYPE (t); - /* If we generated a partial instantiation of this type, but now we're seeing a real definition, we're actually looking at a partial specialization. Consider: |