aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1997-09-02 16:27:13 -0400
committerJason Merrill <jason@gcc.gnu.org>1997-09-02 16:27:13 -0400
commitca79f85d9db6e768bfa918ea4d490692ff996c41 (patch)
treee7e1b571380780a5b2f13eb97afaec7c643af5cd
parent290c8b1fb163f68a39eb4efc0393d550d8794275 (diff)
downloadgcc-ca79f85d9db6e768bfa918ea4d490692ff996c41.zip
gcc-ca79f85d9db6e768bfa918ea4d490692ff996c41.tar.gz
gcc-ca79f85d9db6e768bfa918ea4d490692ff996c41.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog13
-rw-r--r--gcc/cp/parse.y10
-rw-r--r--gcc/cp/pt.c18
-rw-r--r--gcc/cp/typeck.c4
4 files changed, 36 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 46ede96..fc5a66b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index 4eb8a20..47302a0 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -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); }
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 31007ec..19a85e4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 40f8eef..6d2204c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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);
}