Skip to content

Commit 0377ef9

Browse files
committed
Change check for protected device_global members
1 parent f45a351 commit 0377ef9

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
16211621
SemaRef.Diag(D->getLocation(),
16221622
diag::err_sycl_device_global_incorrect_scope);
16231623

1624-
if (Var->getAccess() != AS_public)
1624+
if (Var->getAccess() == AS_private || Var->getAccess() == AS_protected)
16251625
SemaRef.Diag(D->getLocation(),
16261626
diag::err_sycl_device_global_not_publicly_accessible)
16271627
<< Var;

clang/test/SemaSYCL/device_global.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ struct ABar {
6969
};
7070

7171
template <typename T> void fooBar() {
72-
// expected-error@+2{{'device_global' member variable 'c' should be publicly accessible from namespace scope}}
7372
// expected-error@+1{{'device_global' variable must be a static data member or declared in global or namespace scope}}
7473
static device_global<T> c;
75-
// expected-error@+2{{'device_global' member variable 'd' should be publicly accessible from namespace scope}}
7674
// expected-error@+1{{'device_global' variable must be a static data member or declared in global or namespace scope}}
7775
device_global<T> d;
7876
}

0 commit comments

Comments
 (0)