diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index e766558ab30839..602d105715d2b6 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -3964,7 +3964,7 @@ bool ByteCodeExprGen::visitDeclRef(const ValueDecl *D, const Expr *E) { if (const auto *VD = dyn_cast(D)) { // Visit local const variables like normal. if ((VD->isLocalVarDecl() || VD->isStaticDataMember()) && - VD->getType().isConstQualified()) { + VD->getType().isConstant(Ctx.getASTContext())) { if (!this->visitVarDecl(VD)) return false; // Retry. @@ -3973,8 +3973,8 @@ bool ByteCodeExprGen::visitDeclRef(const ValueDecl *D, const Expr *E) { } } else { if (const auto *VD = dyn_cast(D); - VD && VD->getAnyInitializer() && VD->getType().isConstQualified() && - !VD->isWeak()) { + VD && VD->getAnyInitializer() && + VD->getType().isConstant(Ctx.getASTContext()) && !VD->isWeak()) { if (!this->visitVarDecl(VD)) return false; // Retry. diff --git a/clang/test/AST/Interp/opencl.cl b/clang/test/AST/Interp/opencl.cl index fd7756fff7c11e..32cc000cefd30d 100644 --- a/clang/test/AST/Interp/opencl.cl +++ b/clang/test/AST/Interp/opencl.cl @@ -36,3 +36,10 @@ void negativeShift32(int a,int b) { int2 A = {1,2}; int4 B = {(int2)(1,2), (int2)(3,4)}; + + +constant int sz0 = 5; +kernel void testvla() +{ + int vla0[sz0]; +}