Commit ca79f85d by Jason Merrill

pt.c (unify): float doesn't match double.

	* pt.c (unify): float doesn't match double.

	* pt.c (do_type_instantiation): Handle getting a _TYPE or a
 	TYPE_DECL.  Handle getting non-template types.
	* parse.y (explicit_instantiation): Use typespec instead of
	aggr template_type.

Tue Sep  2 10:27:08 1997  Richard Henderson  <rth@cygnus.com>

	* typeck.c (build_ptrmemfunc1): Clean up ptr->int cast warnings.

From-SVN: r15037
parent 290c8b1f
Tue Sep 2 12:09:13 1997 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (unify): float doesn't match double.
* pt.c (do_type_instantiation): Handle getting a _TYPE or a
TYPE_DECL. Handle getting non-template types.
* parse.y (explicit_instantiation): Use typespec instead of
aggr template_type.
Tue Sep 2 10:27:08 1997 Richard Henderson <rth@cygnus.com>
* typeck.c (build_ptrmemfunc1): Clean up ptr->int cast warnings.
Mon Sep 1 13:19:04 1997 Jason Merrill <jason@yorick.cygnus.com> Mon Sep 1 13:19:04 1997 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_new_op): Strip leading REF_BIND from first operand * call.c (build_new_op): Strip leading REF_BIND from first operand
......
...@@ -814,8 +814,9 @@ identifier_defn: ...@@ -814,8 +814,9 @@ identifier_defn:
; ;
explicit_instantiation: explicit_instantiation:
TEMPLATE aggr template_type TEMPLATE typespec ';'
{ do_type_instantiation ($3, NULL_TREE); } { do_type_instantiation ($2.t, NULL_TREE);
yyungetc (';', 1); }
| TEMPLATE typed_declspecs declarator | TEMPLATE typed_declspecs declarator
{ tree specs = strip_attrs ($2.t); { tree specs = strip_attrs ($2.t);
do_decl_instantiation (specs, $3, NULL_TREE); } do_decl_instantiation (specs, $3, NULL_TREE); }
...@@ -823,8 +824,9 @@ explicit_instantiation: ...@@ -823,8 +824,9 @@ explicit_instantiation:
{ do_decl_instantiation (NULL_TREE, $2, NULL_TREE); } { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
| TEMPLATE constructor_declarator | TEMPLATE constructor_declarator
{ do_decl_instantiation (NULL_TREE, $2, NULL_TREE); } { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
| SCSPEC TEMPLATE aggr template_type | SCSPEC TEMPLATE typespec ';'
{ do_type_instantiation ($4, $1); } { do_type_instantiation ($3.t, $1);
yyungetc (';', 1); }
| SCSPEC TEMPLATE typed_declspecs declarator | SCSPEC TEMPLATE typed_declspecs declarator
{ tree specs = strip_attrs ($3.t); { tree specs = strip_attrs ($3.t);
do_decl_instantiation (specs, $4, $1); } do_decl_instantiation (specs, $4, $1); }
......
...@@ -2858,6 +2858,10 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict) ...@@ -2858,6 +2858,10 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict)
TYPE_MAX_VALUE (arg), nsubsts, strict)) TYPE_MAX_VALUE (arg), nsubsts, strict))
return 1; return 1;
} }
else if (TREE_CODE (parm) == REAL_TYPE
&& TYPE_MAIN_VARIANT (arg) != TYPE_MAIN_VARIANT (parm))
return 1;
/* As far as unification is concerned, this wins. Later checks /* As far as unification is concerned, this wins. Later checks
will invalidate it if necessary. */ will invalidate it if necessary. */
return 0; return 0;
...@@ -3314,14 +3318,22 @@ mark_class_instantiated (t, extern_p) ...@@ -3314,14 +3318,22 @@ mark_class_instantiated (t, extern_p)
} }
void void
do_type_instantiation (name, storage) do_type_instantiation (t, storage)
tree name, storage; tree t, storage;
{ {
tree t = TREE_TYPE (name);
int extern_p = 0; int extern_p = 0;
int nomem_p = 0; int nomem_p = 0;
int static_p = 0; int static_p = 0;
if (TREE_CODE (t) == TYPE_DECL)
t = TREE_TYPE (t);
if (! IS_AGGR_TYPE (t) || ! CLASSTYPE_TEMPLATE_INFO (t))
{
cp_error ("explicit instantiation of non-template type `%T'", t);
return;
}
complete_type (t); complete_type (t);
/* With -fexternal-templates, explicit instantiations are treated the same /* With -fexternal-templates, explicit instantiations are treated the same
......
...@@ -6261,14 +6261,14 @@ build_ptrmemfunc1 (type, delta, idx, pfn, delta2) ...@@ -6261,14 +6261,14 @@ build_ptrmemfunc1 (type, delta, idx, pfn, delta2)
if (pfn) if (pfn)
{ {
allconstant = TREE_CONSTANT (pfn); allconstant = TREE_CONSTANT (pfn);
allsimple = (int) initializer_constant_valid_p (pfn, TREE_TYPE (pfn)); allsimple = !! initializer_constant_valid_p (pfn, TREE_TYPE (pfn));
u = tree_cons (pfn_field, pfn, NULL_TREE); u = tree_cons (pfn_field, pfn, NULL_TREE);
} }
else else
{ {
delta2 = convert_and_check (delta_type_node, delta2); delta2 = convert_and_check (delta_type_node, delta2);
allconstant = TREE_CONSTANT (delta2); allconstant = TREE_CONSTANT (delta2);
allsimple = (int) initializer_constant_valid_p (delta2, TREE_TYPE (delta2)); allsimple = !! initializer_constant_valid_p (delta2, TREE_TYPE (delta2));
u = tree_cons (delta2_field, delta2, NULL_TREE); u = tree_cons (delta2_field, delta2, NULL_TREE);
} }
......
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