From: Jason Merrill Date: Wed, 27 Apr 2011 15:56:56 +0000 (-0400) Subject: class.c (resolve_address_of_overloaded_function): Don't change OVERLOAD to TREE_LIST. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c224bdc1ee1b93c4a75b9927d9c961fb4a65131a;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6873f647777..349434f2fe9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-04-27 Jason Merrill + * 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 * parser.c (cp_parser_diagnose_invalid_type_name): Commit to tentative parse sooner. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index fa5e00fcb1f..9af238b25e8 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6514,14 +6514,7 @@ resolve_address_of_overloaded_function (tree target_type, DECL_NAME (OVL_CURRENT (overload)), target_type); - /* print_candidates expects a chain with the functions in - 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); + print_candidates (overload); } return error_mark_node; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index de574a497e8..481306f5f7f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1706,7 +1706,6 @@ print_candidates_1 (tree fns, bool more, const char **str) for (fn = fns; fn; fn = OVL_NEXT (fn)) 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)) print_candidates_1 (TREE_VALUE (fn2), TREE_CHAIN (fn2) || more, 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 print_candidates (tree fns) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 328d8dcbd78..d851890835b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-04-27 Jason Merrill + * g++.old-deja/g++.oliva/overload1.C: Adjust. + * g++.dg/parse/ambig6.C: New. 2011-04-27 Nick Clifton diff --git a/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C b/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C index 91b3b02a439..75c8723c70f 100644 --- a/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C +++ b/gcc/testsuite/g++.old-deja/g++.oliva/overload1.C @@ -6,7 +6,7 @@ // Based on bug report by JDonner struct foo { - static int bar(); // { dg-error "candidate" } + static int bar(); // { dg-error "foo::bar" } void bar(int); // { dg-error "foo::bar" } };