diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 0f6470bf453..378abe94e87 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6708,6 +6708,19 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { NewVD->setInvalidDecl(); return; } + + // OpenCL v2.0 s6.12.5 - Blocks with variadic arguments are not supported. + if (LangOpts.OpenCL && T->isBlockPointerType()) { + const BlockPointerType *BlkTy = T->getAs<BlockPointerType>(); + const FunctionProtoType *FTy = + BlkTy->getPointeeType()->getAs<FunctionProtoType>(); + if (FTy->isVariadic()) { + Diag(NewVD->getLocation(), diag::err_opencl_block_proto_variadic) + << T << NewVD->getSourceRange(); + NewVD->setInvalidDecl(); + return; + } + } } /// \brief Perform semantic checking on a newly-created variable |