2011-08-13 Jason Merrill <jason@redhat.com>
+ PR c++/50075
+ * name-lookup.c (local_bindings_p): New.
+ * name-lookup.h: Declare it.
+ * lex.c (unqualified_name_lookup_error): Use it.
+
PR c++/50059
* error.c (dump_expr): Handle MODIFY_EXPR properly.
}
/* Prevent repeated error messages by creating a VAR_DECL with
this NAME in the innermost block scope. */
- if (current_function_decl)
+ if (local_bindings_p ())
{
tree decl;
decl = build_decl (input_location,
return b->kind == sk_namespace;
}
+/* True if the innermost non-class scope is a block scope. */
+
+bool
+local_bindings_p (void)
+{
+ cp_binding_level *b = innermost_nonclass_level ();
+ return b->kind < sk_function_parms || b->kind == sk_omp;
+}
+
/* True if the current level needs to have a BLOCK made. */
bool
extern bool global_bindings_p (void);
extern bool toplevel_bindings_p (void);
extern bool namespace_bindings_p (void);
+extern bool local_bindings_p (void);
extern bool template_parm_scope_p (void);
extern scope_kind innermost_scope_kind (void);
extern cp_binding_level *begin_scope (scope_kind, tree);
2011-08-13 Jason Merrill <jason@redhat.com>
+ PR c++/50075
+ * g++.dg/cpp0x/decltype32.C: New.
+
PR c++/50059
* g++.dg/diagnostic/expr1.C: New.
--- /dev/null
+// PR c++/50075
+// { dg-options -std=c++0x }
+
+template <typename T>
+auto make_array(const T& il) -> // { dg-error "not declared" }
+decltype(make_array(il))
+{ }
+
+int main()
+{
+ int z = make_array(1); // { dg-error "no match" }
+}