File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -8719,22 +8719,12 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
87198719 if (FunctionDecl *FD = getCurFunctionDecl();
87208720 FD &&
87218721 (FD->hasAttr<CUDADeviceAttr>() || FD->hasAttr<CUDAGlobalAttr>())) {
8722-
8723- auto Check = [&](QualType TypeToCheck, const VarDecl *VD) {
8722+ if (QualType NextTy = NewVD->getType(); NextTy->isArrayType()) {
87248723 if (const ConstantArrayType *ArrayT =
8725- getASTContext().getAsConstantArrayType(TypeToCheck );
8724+ getASTContext().getAsConstantArrayType(NextTy );
87268725 ArrayT && ArrayT->isZeroSize()) {
8727- Diag(VD ->getLocation(), diag::err_typecheck_zero_array_size) << 2;
8726+ Diag(NewVD ->getLocation(), diag::err_typecheck_zero_array_size) << 2;
87288727 }
8729- };
8730- QualType NextTy = NewVD->getType();
8731- while (NextTy->isAnyPointerType() || NextTy->isArrayType() ||
8732- NextTy->isReferenceType()) {
8733- if (NextTy->isArrayType()) {
8734- Check(NextTy, NewVD);
8735- break;
8736- } else
8737- NextTy = NextTy->getPointeeType();
87388728 }
87398729 }
87408730 }
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ __global__ void global_fun() {
1111 extern __shared__ float externArray[];
1212 ZEROARR TypeDef; // expected-error {{zero-length arrays are not permitted in HIP device code}}
1313 float array[0 ]; // expected-error {{zero-length arrays are not permitted in HIP device code}}
14- ZEROARR *Ptr; // expected-error {{zero-length arrays are not permitted in HIP device code}}
1514}
1615
1716// should not throw error for host side code.
You can’t perform that action at this time.
0 commit comments