diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cef8c96dc7c..66418eb7983 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,12 @@ +Wed Sep 3 00:02:53 1997 Jason Merrill + + * typeck.c (convert_arguments): Don't arbitrarily choose the first + of a set of overloaded functions. + Tue Sep 2 12:09:13 1997 Jason Merrill + * lex.c (real_yylex): Don't elide __FUNCTION__. + * method.c (build_overload_value): Add in_template parm. (build_overload_int): Likewise. (build_overload_identifier): Pass it. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c6b28846db8..f2fe0380a93 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4455,9 +4455,9 @@ build_new_function_call (fn, args, obj) return error_mark_node; } - /* Pedantically, it is ill-formed to define a function that could - also be a template instantiation, but we won't implement that - until things settle down. */ + /* Pedantically, normal function declarations are never considered + to refer to template instantiations, but we won't implement that + until we implement full template instantiation syntax. */ if (templates && ! cand->template && ! DECL_INITIAL (cand->fn)) add_maybe_template (cand->fn, templates); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 58c79dfa6a9..83ac1a7de5b 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -3310,30 +3310,6 @@ real_yylex () #endif yylval.ttype = tmp; - - /* A user-invisible read-only initialized variable - should be replaced by its value. We only handle strings - since that's the only case used in C (and C++). */ - /* Note we go right after the local value for the identifier - (e.g., __FUNCTION__ or __PRETTY_FUNCTION__). We used to - call lookup_name, but that could result in an error about - ambiguities. */ - tmp = IDENTIFIER_LOCAL_VALUE (yylval.ttype); - if (tmp != NULL_TREE - && TREE_CODE (tmp) == VAR_DECL - && DECL_IGNORED_P (tmp) - && TREE_READONLY (tmp) - && DECL_INITIAL (tmp) != NULL_TREE - && TREE_CODE (DECL_INITIAL (tmp)) == STRING_CST) - { - tree stringval = DECL_INITIAL (tmp); - - /* Copy the string value so that we won't clobber anything - if we put something in the TREE_CHAIN of this one. */ - yylval.ttype = build_string (TREE_STRING_LENGTH (stringval), - TREE_STRING_POINTER (stringval)); - value = STRING; - } } if (value == NEW && ! global_bindings_p ()) { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 19a85e42cdf..4c79d948aa4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1300,7 +1300,7 @@ instantiate_class_template (type) TREE_VALUE (d) = xref_tag_from_type (TREE_VALUE (d), NULL_TREE, 1); d = tsubst (DECL_TEMPLATE_INJECT (template), &TREE_VEC_ELT (args, 0), - TREE_VEC_LENGTH (args), NULL_TREE); + TREE_VEC_LENGTH (args), NULL_TREE); for (; d; d = TREE_CHAIN (d)) { diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 6d2204ce81c..2204c1f9c32 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2800,18 +2800,12 @@ convert_arguments (return_loc, typelist, values, fndecl, flags) /* Strip the `&' from an overloaded FUNCTION_DECL. */ if (TREE_CODE (val) == ADDR_EXPR) val = TREE_OPERAND (val, 0); - if (TREE_CODE (val) == TREE_LIST - && TREE_CHAIN (val) == NULL_TREE - && TREE_TYPE (TREE_VALUE (val)) != NULL_TREE - && (TREE_TYPE (val) == unknown_type_node - || DECL_CHAIN (TREE_VALUE (val)) == NULL_TREE)) - /* Instantiates automatically. */ - val = TREE_VALUE (val); + if (really_overloaded_fn (val)) + cp_error ("insufficient type information to resolve address of overloaded function `%D'", + DECL_NAME (get_first_fn (val))); else - { - error ("insufficient type information in parameter list"); - val = integer_zero_node; - } + error ("insufficient type information in parameter list"); + val = integer_zero_node; } else if (TREE_CODE (val) == OFFSET_REF && TREE_CODE (TREE_TYPE (val)) == METHOD_TYPE)