diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-11-11 03:42:37 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-11-10 22:42:37 -0500 |
commit | e97e526319f2be937713348635bcafda87a19298 (patch) | |
tree | 0c5b905b1308ff21d85ec67719928230a176a582 | |
parent | a8ec10c9124ba08cb6378f1748a33d9b3f294278 (diff) | |
download | gcc-e97e526319f2be937713348635bcafda87a19298.zip gcc-e97e526319f2be937713348635bcafda87a19298.tar.gz gcc-e97e526319f2be937713348635bcafda87a19298.tar.bz2 |
pt.c (try_one_overload): Take orig_targs again.
* pt.c (try_one_overload): Take orig_targs again. Only check for
mismatches against them; we don't care what a previous call found.
(resolve_overloaded_unification): Adjust.
* search.c (lookup_field): Don't return anything for a non-type
field from a dependent type.
* decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class
in an array declarator.
(start_decl): Push into the class before looking for the field.
From-SVN: r23605
-rw-r--r-- | gcc/cp/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/decl.c | 15 | ||||
-rw-r--r-- | gcc/cp/pt.c | 14 | ||||
-rw-r--r-- | gcc/cp/search.c | 8 |
4 files changed, 38 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b0ad59..475ada1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +1998-11-11 Jason Merrill <jason@yorick.cygnus.com> + + * pt.c (try_one_overload): Take orig_targs again. Only check for + mismatches against them; we don't care what a previous call found. + (resolve_overloaded_unification): Adjust. + + * search.c (lookup_field): Don't return anything for a non-type + field from a dependent type. + * decl.c (grokdeclarator): Resolve SCOPE_REFs of the current class + in an array declarator. + (start_decl): Push into the class before looking for the field. + 1998-11-08 Mark Mitchell <mark@markmitchell.com> * method.c (build_overload_value): Handle REFERENCE_TYPE. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 485d8e4..8b9bb04 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6658,6 +6658,8 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) if (context && TYPE_SIZE (complete_type (context)) != NULL_TREE) { + pushclass (context, 2); + if (TREE_CODE (decl) == VAR_DECL) { tree field = lookup_field (context, DECL_NAME (decl), 0, 0); @@ -6699,8 +6701,6 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl)) cp_pedwarn ("declaration of `%#D' outside of class is not definition", decl); - - pushclass (context, 2); } #ifdef SET_DEFAULT_DECL_ATTRIBUTES @@ -9604,6 +9604,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) constant, but we don't know what the value is yet. */ if (processing_template_decl) { + /* Resolve a qualified reference to an enumerator or + static const data member of ours. */ + if (TREE_CODE (size) == SCOPE_REF + && TREE_OPERAND (size, 0) == current_class_type) + { + tree t = lookup_field (current_class_type, + TREE_OPERAND (size, 1), 0, 0); + if (t) + size = t; + } + itype = make_node (INTEGER_TYPE); TYPE_MIN_VALUE (itype) = size_zero_node; TYPE_MAX_VALUE (itype) = build_min diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c1a8331..5f3fbab 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -80,7 +80,7 @@ static int unify PROTO((tree, tree, tree, tree, int, int*)); static int resolve_overloaded_unification PROTO((tree, tree, tree, tree, unification_kind_t, int, int*)); -static int try_one_overload PROTO((tree, tree, tree, tree, +static int try_one_overload PROTO((tree, tree, tree, tree, tree, unification_kind_t, int, int*)); static int unify PROTO((tree, tree, tree, tree, int, int*)); static void add_pending_template PROTO((tree)); @@ -7031,7 +7031,7 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, if (subargs) { elem = tsubst (TREE_TYPE (fn), subargs, NULL_TREE); - good += try_one_overload (tparms, tempargs, parm, elem, + good += try_one_overload (tparms, targs, tempargs, parm, elem, strict, sub_strict, explicit_mask); } } @@ -7039,7 +7039,7 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, else if (TREE_CODE (arg) == OVERLOAD) { for (; arg; arg = OVL_NEXT (arg)) - good += try_one_overload (tparms, tempargs, parm, + good += try_one_overload (tparms, targs, tempargs, parm, TREE_TYPE (OVL_CURRENT (arg)), strict, sub_strict, explicit_mask); } @@ -7073,9 +7073,9 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, Returns 1 on success. */ static int -try_one_overload (tparms, targs, parm, arg, strict, +try_one_overload (tparms, orig_targs, targs, parm, arg, strict, sub_strict, explicit_mask) - tree tparms, targs, parm, arg; + tree tparms, orig_targs, targs, parm, arg; unification_kind_t strict; int sub_strict; int* explicit_mask; @@ -7107,11 +7107,11 @@ try_one_overload (tparms, targs, parm, arg, strict, return 0; /* First make sure we didn't deduce anything that conflicts with - previously deduced/specified args. */ + explicitly specified args. */ for (i = nargs; i--; ) { tree elt = TREE_VEC_ELT (tempargs, i); - tree oldelt = TREE_VEC_ELT (targs, i); + tree oldelt = TREE_VEC_ELT (orig_targs, i); if (elt == NULL_TREE) continue; diff --git a/gcc/cp/search.c b/gcc/cp/search.c index d9d945f..4157a5d 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1186,11 +1186,15 @@ lookup_field (xbasetype, name, protect, want_type) template <class T> void S<T>::I::f() {} will come through here to handle `S<T>::I'. */ - if (rval && TREE_CODE (rval) == TYPE_DECL - && processing_template_decl + if (rval && processing_template_decl && ! currently_open_class (BINFO_TYPE (rval_binfo)) && uses_template_parms (type)) { + /* 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) + return NULL_TREE; + binfo = rval_binfo; for (; ; binfo = BINFO_INHERITANCE_CHAIN (binfo)) if (BINFO_INHERITANCE_CHAIN (binfo) == NULL_TREE |