summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 11:11:31 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-03 11:11:31 +0000
commit4a7973e17f0725fa61793b53ea888d3e8d2a1cfa (patch)
treee503a93e70f05996ba48140b302a914cfbfc7f6f
parentca94bc0ddf82d30bf92cd8ee4919bf1e10dc19f5 (diff)
downloadgcc-4a7973e17f0725fa61793b53ea888d3e8d2a1cfa.tar.gz
/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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206313 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/name-lookup.c12
-rw-r--r--gcc/cp/name-lookup.h2
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/cp/semantics.c10
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for28.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/range-for3.C2
10 files changed, 46 insertions, 23 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 006c85ba8ef..e89bc50baa8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index c2bd04ecf1c..bdae500d374 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 96850116d98..28f998d7fd7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -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;
}
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 29b728569f2..a63442f85c2 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -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);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 35dcefd2656..c99c1fcb645 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index add4cc61d5d..3b8f83a596c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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))
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 91bdb83bbbc..0bb64c7752b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ebc453d5901..0950914255e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for28.C b/gcc/testsuite/g++.dg/cpp0x/range-for28.C
new file mode 100644
index 00000000000..5007349949a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for28.C
@@ -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" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/range-for3.C b/gcc/testsuite/g++.dg/cpp0x/range-for3.C
index c2204f91758..2f1ce382651 100644
--- a/gcc/testsuite/g++.dg/cpp0x/range-for3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/range-for3.C
@@ -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" }
{
}
}