Conversion of default arguments is an implicit conversion, so it should
use LOOKUP_IMPLICIT.
A recent bug involved cp_parser_abort_tentative_parse failing to abort
because we had already committed to the tentative parse. So let's avoid
that in future.
Tested x86_64-pc-linux-gnu, applied to trunk.
commit 3a0d4ffbbc688196baa21a716a7f74efc172001e
Author: Jason Merrill <ja...@redhat.com>
Date: Sat Dec 4 01:25:27 2010 -0500
* call.c (convert_default_arg): Use LOOKUP_IMPLICIT.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 499ed03..388f46c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5803,7 +5803,7 @@ convert_default_arg (tree type, tree arg, tree fn, int
parmnum)
if (TREE_CODE (arg) == CONSTRUCTOR)
{
arg = digest_init (type, arg);
- arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
+ arg = convert_for_initialization (0, type, arg, LOOKUP_IMPLICIT,
ICR_DEFAULT_ARGUMENT, fn, parmnum,
tf_warning_or_error);
}
@@ -5817,7 +5817,7 @@ convert_default_arg (tree type, tree arg, tree fn, int
parmnum)
are never modified in place. */
if (!CONSTANT_CLASS_P (arg))
arg = unshare_expr (arg);
- arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
+ arg = convert_for_initialization (0, type, arg, LOOKUP_IMPLICIT,
ICR_DEFAULT_ARGUMENT, fn, parmnum,
tf_warning_or_error);
arg = convert_for_arg_passing (type, arg);
commit 29e182ba0f92d58fc46c60595de30d2069009c42
Author: Jason Merrill <ja...@redhat.com>
Date: Fri Mar 11 17:53:21 2011 -0500
* parser.c (cp_parser_abort_tentative_parse): Make sure we haven't
committed to this tentative parse.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a9fd201..9523fdc 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -21398,6 +21398,8 @@ cp_parser_commit_to_tentative_parse (cp_parser* parser)
static void
cp_parser_abort_tentative_parse (cp_parser* parser)
{
+ gcc_assert (parser->context->status != CP_PARSER_STATUS_KIND_COMMITTED
+ || errorcount > 0);
cp_parser_simulate_error (parser);
/* Now, pretend that we want to see if the construct was
successfully parsed. */