diff options
author | Jason Merrill <jason@redhat.com> | 2011-08-14 00:41:43 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-08-14 00:41:43 -0400 |
commit | fdf03377272dc39c9c9ceea453282ba7a8032142 (patch) | |
tree | 97ad70a23b265deb3ad4b09c18d9cf2bd1cd9038 /gcc/cp | |
parent | b23903f787aaaf84dea18ae8c19dbb232c6ae552 (diff) | |
download | gcc-fdf03377272dc39c9c9ceea453282ba7a8032142.zip gcc-fdf03377272dc39c9c9ceea453282ba7a8032142.tar.gz gcc-fdf03377272dc39c9c9ceea453282ba7a8032142.tar.bz2 |
re PR c++/50075 ([C++0x] ICE related to parameter deduction and initializer_list)
PR c++/50075
* name-lookup.c (local_bindings_p): New.
* name-lookup.h: Declare it.
* lex.c (unqualified_name_lookup_error): Use it.
From-SVN: r177743
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/lex.c | 2 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 9 | ||||
-rw-r--r-- | gcc/cp/name-lookup.h | 1 |
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2f2b306..c5ecf55 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 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. diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 691a2ec..c11e3b3 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -456,7 +456,7 @@ unqualified_name_lookup_error (tree name) } /* 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, diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 1afd9ed..64456b4 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1608,6 +1608,15 @@ namespace_bindings_p (void) 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 diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index 5974dce..a37afdb 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -292,6 +292,7 @@ extern bool kept_level_p (void); 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); |