Skip to content

Commit 2bb7e00

Browse files
[Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType.
Fixes llvm#62087 Differential Revision: https://reviews.llvm.org/D148919
1 parent 593e25f commit 2bb7e00

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8705,7 +8705,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
87058705
}
87068706

87078707
// Check that SVE types are only used in functions with SVE available.
8708-
if (T->isSVESizelessBuiltinType() && CurContext->isFunctionOrMethod()) {
8708+
if (T->isSVESizelessBuiltinType() && isa<FunctionDecl>(CurContext)) {
87098709
const FunctionDecl *FD = cast<FunctionDecl>(CurContext);
87108710
llvm::StringMap<bool> CallerFeatureMap;
87118711
Context.getFunctionFeatureMap(CallerFeatureMap, FD);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -fopenmp -fsyntax-only -triple aarch64-arm-none-eabi -target-feature +sve -verify %s
2+
// expected-no-diagnostics
3+
4+
__SVBool_t foo(int);
5+
6+
void test() {
7+
#pragma omp parallel
8+
{
9+
__SVBool_t pg = foo(1);
10+
}
11+
}

0 commit comments

Comments
 (0)