Commit c224bdc1 by Jason Merrill Committed by Jason Merrill

class.c (resolve_address_of_overloaded_function): Don't change OVERLOAD to TREE_LIST.

	* class.c (resolve_address_of_overloaded_function): Don't
	change OVERLOAD to TREE_LIST.
	* pt.c (print_candidates_1): Remove nonsensical assert.

From-SVN: r173037
parent 9e0541d9
2011-04-27 Jason Merrill <jason@redhat.com> 2011-04-27 Jason Merrill <jason@redhat.com>
* class.c (resolve_address_of_overloaded_function): Don't
change OVERLOAD to TREE_LIST.
* pt.c (print_candidates_1): Remove nonsensical assert.
PR c++/48046 PR c++/48046
* parser.c (cp_parser_diagnose_invalid_type_name): Commit * parser.c (cp_parser_diagnose_invalid_type_name): Commit
to tentative parse sooner. to tentative parse sooner.
......
...@@ -6514,14 +6514,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -6514,14 +6514,7 @@ resolve_address_of_overloaded_function (tree target_type,
DECL_NAME (OVL_CURRENT (overload)), DECL_NAME (OVL_CURRENT (overload)),
target_type); target_type);
/* print_candidates expects a chain with the functions in print_candidates (overload);
TREE_VALUE slots, so we cons one up here (we're losing anyway,
so why be clever?). */
for (; overload; overload = OVL_NEXT (overload))
matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
matches);
print_candidates (matches);
} }
return error_mark_node; return error_mark_node;
} }
......
...@@ -1706,7 +1706,6 @@ print_candidates_1 (tree fns, bool more, const char **str) ...@@ -1706,7 +1706,6 @@ print_candidates_1 (tree fns, bool more, const char **str)
for (fn = fns; fn; fn = OVL_NEXT (fn)) for (fn = fns; fn; fn = OVL_NEXT (fn))
if (TREE_CODE (fn) == TREE_LIST) if (TREE_CODE (fn) == TREE_LIST)
{ {
gcc_assert (!OVL_NEXT (fn) && !is_overloaded_fn (fn));
for (fn2 = fn; fn2 != NULL_TREE; fn2 = TREE_CHAIN (fn2)) for (fn2 = fn; fn2 != NULL_TREE; fn2 = TREE_CHAIN (fn2))
print_candidates_1 (TREE_VALUE (fn2), print_candidates_1 (TREE_VALUE (fn2),
TREE_CHAIN (fn2) || more, str); TREE_CHAIN (fn2) || more, str);
...@@ -1736,7 +1735,8 @@ print_candidates_1 (tree fns, bool more, const char **str) ...@@ -1736,7 +1735,8 @@ print_candidates_1 (tree fns, bool more, const char **str)
} }
} }
/* Print the list of candidate FNS in an error message. */ /* Print the list of candidate FNS in an error message. FNS can also
be a TREE_LIST of non-functions in the case of an ambiguous lookup. */
void void
print_candidates (tree fns) print_candidates (tree fns)
......
2011-04-27 Jason Merrill <jason@redhat.com> 2011-04-27 Jason Merrill <jason@redhat.com>
* g++.old-deja/g++.oliva/overload1.C: Adjust.
* g++.dg/parse/ambig6.C: New. * g++.dg/parse/ambig6.C: New.
2011-04-27 Nick Clifton <nickc@redhat.com> 2011-04-27 Nick Clifton <nickc@redhat.com>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Based on bug report by JDonner <jdonner@schedsys.com> // Based on bug report by JDonner <jdonner@schedsys.com>
struct foo { struct foo {
static int bar(); // { dg-error "candidate" } static int bar(); // { dg-error "foo::bar" }
void bar(int); // { dg-error "foo::bar" } void bar(int); // { dg-error "foo::bar" }
}; };
......
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