pt.c (unify): float doesn't match double.
authorJason Merrill <jason@gcc.gnu.org>
Tue, 2 Sep 1997 20:27:13 +0000 (16:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 2 Sep 1997 20:27:13 +0000 (16:27 -0400)
* 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

gcc/cp/ChangeLog
gcc/cp/parse.y
gcc/cp/pt.c
gcc/cp/typeck.c

index 46ede9667c4b8e608d9e5fb49a5426c1e1379fde..fc5a66b51ecee8d7bc8811347bfdd4c9c3f14fc8 100644 (file)
@@ -1,3 +1,16 @@
+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>
 
        * call.c (build_new_op): Strip leading REF_BIND from first operand
index 4eb8a20eb783288263779d39c1628a3efa15e3d5..47302a0cc578e1c0db0996b96152cd99fc2a06a4 100644 (file)
@@ -814,8 +814,9 @@ identifier_defn:
        ;
 
 explicit_instantiation:
-         TEMPLATE aggr template_type
-               { do_type_instantiation ($3, NULL_TREE); }
+         TEMPLATE typespec ';'
+               { do_type_instantiation ($2.t, NULL_TREE);
+                 yyungetc (';', 1); }
        | TEMPLATE typed_declspecs declarator
                { tree specs = strip_attrs ($2.t);
                  do_decl_instantiation (specs, $3, NULL_TREE); }
@@ -823,8 +824,9 @@ explicit_instantiation:
                { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
        | TEMPLATE constructor_declarator
                { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
-       | SCSPEC TEMPLATE aggr template_type
-               { do_type_instantiation ($4, $1); }
+       | SCSPEC TEMPLATE typespec ';'
+               { do_type_instantiation ($3.t, $1);
+                 yyungetc (';', 1); }
        | SCSPEC TEMPLATE typed_declspecs declarator
                { tree specs = strip_attrs ($3.t);
                  do_decl_instantiation (specs, $4, $1); }
index 31007ec84ecac8459635f539387605ad3635164e..19a85e42cdffa1e8399a4cd73e9643ca79bd1099 100644 (file)
@@ -2858,6 +2858,10 @@ unify (tparms, targs, ntparms, parm, arg, nsubsts, strict)
                        TYPE_MAX_VALUE (arg), nsubsts, strict))
            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
         will invalidate it if necessary.  */
       return 0;
@@ -3314,14 +3318,22 @@ mark_class_instantiated (t, extern_p)
 }     
 
 void
-do_type_instantiation (name, storage)
-     tree name, storage;
+do_type_instantiation (t, storage)
+     tree t, storage;
 {
-  tree t = TREE_TYPE (name);
   int extern_p = 0;
   int nomem_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);
 
   /* With -fexternal-templates, explicit instantiations are treated the same
index 40f8eef82404f48736f23ca6833c053ba2e4d329..6d2204ce81c16a1b3dd3b8a8e7a98fb61fde0538 100644 (file)
@@ -6261,14 +6261,14 @@ build_ptrmemfunc1 (type, delta, idx, pfn, delta2)
   if (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);
     }
   else
     {
       delta2 = convert_and_check (delta_type_node, 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);
     }