From ff350acdf9d740f93559072fc1022d2956e2ba07 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 19 Nov 1998 02:35:15 +0000 Subject: semantics.c (begin_class_definition): Call maybe_process_partial_specialization before push_template_decl. * semantics.c (begin_class_definition): Call maybe_process_partial_specialization before push_template_decl. Don't call push_template_decl for a specialization. * search.c (lookup_field): Do return a member template class. * decl2.c (handle_class_head): Handle member template classes. * decl.c (grokdeclarator): A parm type need not be complete. * pt.c (convert_nontype_argument): Fix thinko. From-SVN: r23705 --- gcc/cp/ChangeLog | 12 ++++++++++++ gcc/cp/decl.c | 2 +- gcc/cp/decl2.c | 2 ++ gcc/cp/pt.c | 4 ++-- gcc/cp/search.c | 5 +++++ gcc/cp/semantics.c | 7 ++++--- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5f56a03..367be02 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +1998-11-19 Jason Merrill + + * semantics.c (begin_class_definition): Call + maybe_process_partial_specialization before push_template_decl. + Don't call push_template_decl for a specialization. + * search.c (lookup_field): Do return a member template class. + * decl2.c (handle_class_head): Handle member template classes. + + * decl.c (grokdeclarator): A parm type need not be complete. + + * pt.c (convert_nontype_argument): Fix thinko. + 1998-11-18 Mark Mitchell * cp-tree.h (PTRMEM_CST_CLASS): Fix typo. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8980c11..a373f1f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10530,7 +10530,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) if (decl_context == PARM) { - decl = build_decl (PARM_DECL, declarator, complete_type (type)); + decl = build_decl (PARM_DECL, declarator, type); bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE, inlinep, friendp, raises != NULL_TREE); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index c2b4a1d..c8ad1fe 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4946,6 +4946,8 @@ handle_class_head (aggr, scope, id) { if (TREE_CODE (id) == TYPE_DECL) return id; + if (DECL_CLASS_TEMPLATE_P (id)) + return DECL_TEMPLATE_RESULT (id); if (scope) cp_error ("`%T' does not have a nested type named `%D'", scope, id); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9955835..27e63d7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2687,8 +2687,8 @@ convert_nontype_argument (type, expr) identical) type of the template-argument. The template-parameter is bound directly to the template-argument, which must be an lvalue. */ - if (!same_type_p (TYPE_MAIN_VARIANT (expr_type), - TYPE_MAIN_VARIANT (type)) + if ((TYPE_MAIN_VARIANT (expr_type) + != TYPE_MAIN_VARIANT (type_referred_to)) || !at_least_as_qualified_p (type_referred_to, expr_type) || !real_lvalue_p (expr)) diff --git a/gcc/cp/search.c b/gcc/cp/search.c index f9ec9dc..8d507dc 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1190,6 +1190,11 @@ lookup_field (xbasetype, name, protect, want_type) && ! currently_open_class (BINFO_TYPE (rval_binfo)) && uses_template_parms (type)) { + /* We need to return a member template class so we can define partial + specializations. Is there a better way? */ + if (DECL_CLASS_TEMPLATE_P (rval)) + return rval; + /* Don't return a non-type. Actually, we ought to return something so lookup_name_real can give a warning. */ if (TREE_CODE (rval) != TYPE_DECL) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5e3876f..b1278dc 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1230,11 +1230,12 @@ begin_class_definition (t) t = make_lang_type (TREE_CODE (t)); pushtag (TYPE_IDENTIFIER (t), t, 0); } - if (processing_template_decl && TYPE_CONTEXT (t) - && TREE_CODE (TYPE_CONTEXT (t)) != NAMESPACE_DECL + maybe_process_partial_specialization (t); + if (processing_template_decl + && ! CLASSTYPE_TEMPLATE_SPECIALIZATION (t) + && TYPE_CONTEXT (t) && TYPE_P (TYPE_CONTEXT (t)) && ! current_class_type) push_template_decl (TYPE_STUB_DECL (t)); - maybe_process_partial_specialization (t); pushclass (t, 0); TYPE_BEING_DEFINED (t) = 1; /* Reset the interface data, at the earliest possible -- cgit v1.1