diff options
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 0ceb5bc..45fdafc 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -539,7 +539,11 @@ int at_function_scope_p (void) { tree cs = current_scope (); - return cs && TREE_CODE (cs) == FUNCTION_DECL; + /* Also check cfun to make sure that we're really compiling + this function (as opposed to having set current_function_decl + for access checking or some such). */ + return (cs && TREE_CODE (cs) == FUNCTION_DECL + && cfun && cfun->decl == current_function_decl); } /* Returns true if the innermost active scope is a class scope. */ |