Commit ff350acd by Jason Merrill Committed by Jason Merrill

semantics.c (begin_class_definition): Call maybe_process_partial_specialization…

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
parent c877974e
1998-11-19 Jason Merrill <jason@yorick.cygnus.com>
* 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 <mark@markmitchell.com> 1998-11-18 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (PTRMEM_CST_CLASS): Fix typo. * cp-tree.h (PTRMEM_CST_CLASS): Fix typo.
......
...@@ -10530,7 +10530,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10530,7 +10530,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == PARM) 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, bad_specifiers (decl, "parameter", virtualp, quals != NULL_TREE,
inlinep, friendp, raises != NULL_TREE); inlinep, friendp, raises != NULL_TREE);
......
...@@ -4946,6 +4946,8 @@ handle_class_head (aggr, scope, id) ...@@ -4946,6 +4946,8 @@ handle_class_head (aggr, scope, id)
{ {
if (TREE_CODE (id) == TYPE_DECL) if (TREE_CODE (id) == TYPE_DECL)
return id; return id;
if (DECL_CLASS_TEMPLATE_P (id))
return DECL_TEMPLATE_RESULT (id);
if (scope) if (scope)
cp_error ("`%T' does not have a nested type named `%D'", scope, id); cp_error ("`%T' does not have a nested type named `%D'", scope, id);
......
...@@ -2687,8 +2687,8 @@ convert_nontype_argument (type, expr) ...@@ -2687,8 +2687,8 @@ convert_nontype_argument (type, expr)
identical) type of the template-argument. The identical) type of the template-argument. The
template-parameter is bound directly to the template-parameter is bound directly to the
template-argument, which must be an lvalue. */ template-argument, which must be an lvalue. */
if (!same_type_p (TYPE_MAIN_VARIANT (expr_type), if ((TYPE_MAIN_VARIANT (expr_type)
TYPE_MAIN_VARIANT (type)) != TYPE_MAIN_VARIANT (type_referred_to))
|| !at_least_as_qualified_p (type_referred_to, || !at_least_as_qualified_p (type_referred_to,
expr_type) expr_type)
|| !real_lvalue_p (expr)) || !real_lvalue_p (expr))
......
...@@ -1190,6 +1190,11 @@ lookup_field (xbasetype, name, protect, want_type) ...@@ -1190,6 +1190,11 @@ lookup_field (xbasetype, name, protect, want_type)
&& ! currently_open_class (BINFO_TYPE (rval_binfo)) && ! currently_open_class (BINFO_TYPE (rval_binfo))
&& uses_template_parms (type)) && 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 /* Don't return a non-type. Actually, we ought to return something
so lookup_name_real can give a warning. */ so lookup_name_real can give a warning. */
if (TREE_CODE (rval) != TYPE_DECL) if (TREE_CODE (rval) != TYPE_DECL)
......
...@@ -1230,11 +1230,12 @@ begin_class_definition (t) ...@@ -1230,11 +1230,12 @@ begin_class_definition (t)
t = make_lang_type (TREE_CODE (t)); t = make_lang_type (TREE_CODE (t));
pushtag (TYPE_IDENTIFIER (t), t, 0); pushtag (TYPE_IDENTIFIER (t), t, 0);
} }
if (processing_template_decl && TYPE_CONTEXT (t) maybe_process_partial_specialization (t);
&& TREE_CODE (TYPE_CONTEXT (t)) != NAMESPACE_DECL if (processing_template_decl
&& ! CLASSTYPE_TEMPLATE_SPECIALIZATION (t)
&& TYPE_CONTEXT (t) && TYPE_P (TYPE_CONTEXT (t))
&& ! current_class_type) && ! current_class_type)
push_template_decl (TYPE_STUB_DECL (t)); push_template_decl (TYPE_STUB_DECL (t));
maybe_process_partial_specialization (t);
pushclass (t, 0); pushclass (t, 0);
TYPE_BEING_DEFINED (t) = 1; TYPE_BEING_DEFINED (t) = 1;
/* Reset the interface data, at the earliest possible /* Reset the interface data, at the earliest possible
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment