aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2018-03-09 12:13:55 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-03-09 12:13:55 +0000
commitd04e6ed5ae7668dc8a68069cd456d278c59fd972 (patch)
treee0926d3f76b09c3b20bde7e7cfce55282fdfca45 /gcc/cp
parent77a5c1b62dad78448fedb355a22be81adf5892f7 (diff)
downloadgcc-d04e6ed5ae7668dc8a68069cd456d278c59fd972.zip
gcc-d04e6ed5ae7668dc8a68069cd456d278c59fd972.tar.gz
gcc-d04e6ed5ae7668dc8a68069cd456d278c59fd972.tar.bz2
[PR c++/84733] ICE in check-local-shadow
https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00425.html PR c++/84733 * name-lookup.c (do_pushdecl_with_scope): Only clear current_function_decl when pushing a non-class (i.e. namespace) scope. From-SVN: r258383
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/name-lookup.c7
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3c1e4c7..eeaf71d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-03-09 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/84733
+ * name-lookup.c (do_pushdecl_with_scope): Only clear
+ current_function_decl when pushing a non-class (i.e. namespace)
+ scope.
+
2018-03-08 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2773cf4..80a92ab 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3965,9 +3965,7 @@ static tree
do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend)
{
cp_binding_level *b;
- tree function_decl = current_function_decl;
- current_function_decl = NULL_TREE;
if (level->kind == sk_class)
{
b = class_binding_level;
@@ -3977,12 +3975,15 @@ do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend)
}
else
{
+ tree function_decl = current_function_decl;
+ if (level->kind == sk_namespace)
+ current_function_decl = NULL_TREE;
b = current_binding_level;
current_binding_level = level;
x = pushdecl (x, is_friend);
current_binding_level = b;
+ current_function_decl = function_decl;
}
- current_function_decl = function_decl;
return x;
}