aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r--gcc/c/c-parser.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 17a28e9..d1c954c 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -16580,6 +16580,15 @@ c_parser_oacc_declare (c_parser *parser)
break;
}
+ if (!c_check_in_current_scope (decl))
+ {
+ error_at (loc,
+ "%qD must be a variable declared in the same scope as "
+ "%<#pragma acc declare%>", decl);
+ error = true;
+ continue;
+ }
+
if (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl))
|| lookup_attribute ("omp declare target link",
DECL_ATTRIBUTES (decl)))