Core DR 1442 PR c++/59165
/cp 2014-01-03 Paolo Carlini <paolo.carlini@oracle.com> Core DR 1442 PR c++/59165 * parser.c (cp_parser_perform_range_for_lookup): Don't pass true as include_std to perform_koenig_lookup. (cp_parser_postfix_expression): Adjust. * pt.c (tsubst_copy_and_build): Likewise. * semantics.c (perform_koenig_lookup): Remove bool parameter. (omp_reduction_lookup): Adjust. * name-lookup.c (lookup_arg_dependent_1): Remove bool parameter. (lookup_arg_dependent): Likewise. (lookup_function_nonclass): Adjust. * name-lookup.h: Adjust declaration. * cp-tree.h: Likewise. /testsuite 2014-01-03 Paolo Carlini <paolo.carlini@oracle.com> Core DR 1442 PR c++/59165 * g++.dg/cpp0x/range-for28.C: New. * g++.dg/cpp0x/range-for3.C: Update. From-SVN: r206313
This commit is contained in:
parent
039eee3f12
commit
cdc23b1b20
@ -1,3 +1,19 @@
|
||||
2014-01-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
Core DR 1442
|
||||
PR c++/59165
|
||||
* parser.c (cp_parser_perform_range_for_lookup): Don't pass true
|
||||
as include_std to perform_koenig_lookup.
|
||||
(cp_parser_postfix_expression): Adjust.
|
||||
* pt.c (tsubst_copy_and_build): Likewise.
|
||||
* semantics.c (perform_koenig_lookup): Remove bool parameter.
|
||||
(omp_reduction_lookup): Adjust.
|
||||
* name-lookup.c (lookup_arg_dependent_1): Remove bool parameter.
|
||||
(lookup_arg_dependent): Likewise.
|
||||
(lookup_function_nonclass): Adjust.
|
||||
* name-lookup.h: Adjust declaration.
|
||||
* cp-tree.h: Likewise.
|
||||
|
||||
2014-01-02 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR c++/59087
|
||||
|
@ -5744,7 +5744,7 @@ extern tree finish_stmt_expr_expr (tree, tree);
|
||||
extern tree finish_stmt_expr (tree, bool);
|
||||
extern tree stmt_expr_value_expr (tree);
|
||||
bool empty_expr_stmt_p (tree);
|
||||
extern tree perform_koenig_lookup (tree, vec<tree, va_gc> *, bool,
|
||||
extern tree perform_koenig_lookup (tree, vec<tree, va_gc> *,
|
||||
tsubst_flags_t);
|
||||
extern tree finish_call_expr (tree, vec<tree, va_gc> **, bool,
|
||||
bool, tsubst_flags_t);
|
||||
|
@ -4879,7 +4879,7 @@ lookup_function_nonclass (tree name, vec<tree, va_gc> *args, bool block_p)
|
||||
return
|
||||
lookup_arg_dependent (name,
|
||||
lookup_name_real (name, 0, 1, block_p, 0, 0),
|
||||
args, false);
|
||||
args);
|
||||
}
|
||||
|
||||
tree
|
||||
@ -5578,8 +5578,7 @@ arg_assoc (struct arg_lookup *k, tree n)
|
||||
are the functions found in normal lookup. */
|
||||
|
||||
static tree
|
||||
lookup_arg_dependent_1 (tree name, tree fns, vec<tree, va_gc> *args,
|
||||
bool include_std)
|
||||
lookup_arg_dependent_1 (tree name, tree fns, vec<tree, va_gc> *args)
|
||||
{
|
||||
struct arg_lookup k;
|
||||
|
||||
@ -5617,8 +5616,6 @@ lookup_arg_dependent_1 (tree name, tree fns, vec<tree, va_gc> *args,
|
||||
else
|
||||
k.fn_set = NULL;
|
||||
|
||||
if (include_std)
|
||||
arg_assoc_namespace (&k, std_node);
|
||||
arg_assoc_args_vec (&k, args);
|
||||
|
||||
fns = k.functions;
|
||||
@ -5643,13 +5640,12 @@ lookup_arg_dependent_1 (tree name, tree fns, vec<tree, va_gc> *args,
|
||||
/* Wrapper for lookup_arg_dependent_1. */
|
||||
|
||||
tree
|
||||
lookup_arg_dependent (tree name, tree fns, vec<tree, va_gc> *args,
|
||||
bool include_std)
|
||||
lookup_arg_dependent (tree name, tree fns, vec<tree, va_gc> *args)
|
||||
{
|
||||
tree ret;
|
||||
bool subtime;
|
||||
subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
||||
ret = lookup_arg_dependent_1 (name, fns, args, include_std);
|
||||
ret = lookup_arg_dependent_1 (name, fns, args);
|
||||
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
||||
return ret;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ extern void do_toplevel_using_decl (tree, tree, tree);
|
||||
extern void do_local_using_decl (tree, tree, tree);
|
||||
extern tree do_class_using_decl (tree, tree);
|
||||
extern void do_using_directive (tree);
|
||||
extern tree lookup_arg_dependent (tree, tree, vec<tree, va_gc> *, bool);
|
||||
extern tree lookup_arg_dependent (tree, tree, vec<tree, va_gc> *);
|
||||
extern bool is_associated_namespace (tree, tree);
|
||||
extern void parse_using_directive (tree, tree);
|
||||
extern tree innermost_non_namespace_value (tree);
|
||||
|
@ -6076,7 +6076,6 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
|
||||
if (!any_type_dependent_arguments_p (args))
|
||||
postfix_expression
|
||||
= perform_koenig_lookup (postfix_expression, args,
|
||||
/*include_std=*/false,
|
||||
complain);
|
||||
}
|
||||
else
|
||||
@ -6102,7 +6101,6 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
|
||||
if (!any_type_dependent_arguments_p (args))
|
||||
postfix_expression
|
||||
= perform_koenig_lookup (postfix_expression, args,
|
||||
/*include_std=*/false,
|
||||
complain);
|
||||
}
|
||||
}
|
||||
@ -10356,12 +10354,10 @@ cp_parser_perform_range_for_lookup (tree range, tree *begin, tree *end)
|
||||
vec_safe_push (vec, range);
|
||||
|
||||
member_begin = perform_koenig_lookup (id_begin, vec,
|
||||
/*include_std=*/true,
|
||||
tf_warning_or_error);
|
||||
*begin = finish_call_expr (member_begin, &vec, false, true,
|
||||
tf_warning_or_error);
|
||||
member_end = perform_koenig_lookup (id_end, vec,
|
||||
/*include_std=*/true,
|
||||
tf_warning_or_error);
|
||||
*end = finish_call_expr (member_end, &vec, false, true,
|
||||
tf_warning_or_error);
|
||||
|
@ -14490,8 +14490,7 @@ tsubst_copy_and_build (tree t,
|
||||
into a non-dependent call. */
|
||||
&& type_dependent_expression_p_push (t)
|
||||
&& !any_type_dependent_arguments_p (call_args))
|
||||
function = perform_koenig_lookup (function, call_args, false,
|
||||
tf_none);
|
||||
function = perform_koenig_lookup (function, call_args, tf_none);
|
||||
|
||||
if (identifier_p (function)
|
||||
&& !any_type_dependent_arguments_p (call_args))
|
||||
|
@ -2041,12 +2041,10 @@ empty_expr_stmt_p (tree expr_stmt)
|
||||
|
||||
/* Perform Koenig lookup. FN is the postfix-expression representing
|
||||
the function (or functions) to call; ARGS are the arguments to the
|
||||
call; if INCLUDE_STD then the `std' namespace is automatically
|
||||
considered an associated namespace (used in range-based for loops).
|
||||
Returns the functions to be considered by overload resolution. */
|
||||
call. Returns the functions to be considered by overload resolution. */
|
||||
|
||||
tree
|
||||
perform_koenig_lookup (tree fn, vec<tree, va_gc> *args, bool include_std,
|
||||
perform_koenig_lookup (tree fn, vec<tree, va_gc> *args,
|
||||
tsubst_flags_t complain)
|
||||
{
|
||||
tree identifier = NULL_TREE;
|
||||
@ -2083,7 +2081,7 @@ perform_koenig_lookup (tree fn, vec<tree, va_gc> *args, bool include_std,
|
||||
if (!any_type_dependent_arguments_p (args)
|
||||
&& !any_dependent_template_arguments_p (tmpl_args))
|
||||
{
|
||||
fn = lookup_arg_dependent (identifier, functions, args, include_std);
|
||||
fn = lookup_arg_dependent (identifier, functions, args);
|
||||
if (!fn)
|
||||
{
|
||||
/* The unqualified name could not be resolved. */
|
||||
@ -4643,7 +4641,7 @@ omp_reduction_lookup (location_t loc, tree id, tree type, tree *baselinkp,
|
||||
{
|
||||
vec<tree, va_gc> *args = NULL;
|
||||
vec_safe_push (args, build_reference_type (type));
|
||||
id = perform_koenig_lookup (id, args, false, tf_none);
|
||||
id = perform_koenig_lookup (id, args, tf_none);
|
||||
}
|
||||
}
|
||||
else if (TREE_CODE (id) == SCOPE_REF)
|
||||
|
@ -1,3 +1,10 @@
|
||||
2014-01-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
Core DR 1442
|
||||
PR c++/59165
|
||||
* g++.dg/cpp0x/range-for28.C: New.
|
||||
* g++.dg/cpp0x/range-for3.C: Update.
|
||||
|
||||
2014-01-02 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* gcc.target/powerpc/rs6000-ldouble-3.c: New test.
|
||||
|
11
gcc/testsuite/g++.dg/cpp0x/range-for28.C
Normal file
11
gcc/testsuite/g++.dg/cpp0x/range-for28.C
Normal file
@ -0,0 +1,11 @@
|
||||
// PR c++/59165
|
||||
// { dg-require-effective-target c++11 }
|
||||
|
||||
namespace std {
|
||||
int* begin(int i) { return (int*)0; }
|
||||
int* end(int i) { return (int*)0; }
|
||||
}
|
||||
|
||||
int main() {
|
||||
for (int a : 10) { } // { dg-error "was not declared" }
|
||||
}
|
@ -36,7 +36,7 @@ namespace std
|
||||
int main()
|
||||
{
|
||||
container c(1,4);
|
||||
for (int it : c)
|
||||
for (int it : c) // { dg-error "was not declared" }
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user