diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -8769,6 +8769,8 @@ return; } } + + checkTypeSupport(T, NewVD->getLocation(), cast(CurContext)); } /// Perform semantic checking on a newly-created variable diff --git a/clang/test/Sema/riscv-types.c b/clang/test/Sema/riscv-types.c --- a/clang/test/Sema/riscv-types.c +++ b/clang/test/Sema/riscv-types.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple riscv64 -target-feature +v -ast-print %s \ -// RUN: | FileCheck %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +v \ +// RUN: -target-feature +experimental-zvfh -ast-print %s | FileCheck %s void bar(void) { // CHECK: __rvv_int64m1_t x0; diff --git a/clang/test/Sema/riscv-vector-float16-check.c b/clang/test/Sema/riscv-vector-float16-check.c --- a/clang/test/Sema/riscv-vector-float16-check.c +++ b/clang/test/Sema/riscv-vector-float16-check.c @@ -6,3 +6,7 @@ vfloat16m1_t foo() { /* expected-error {{RISC-V type 'vfloat16m1_t' (aka '__rvv_float16m1_t') requires the 'zvfh' extension}} */ } /* expected-warning {{non-void function does not return a value}}*/ + +void bar(void) { + vfloat16m1_t f16m1; /* expected-error {{RISC-V type 'vfloat16m1_t' (aka '__rvv_float16m1_t') requires the 'zvfh' extension}} */ +} diff --git a/clang/test/Sema/riscv-vector-float32-check.c b/clang/test/Sema/riscv-vector-float32-check.c --- a/clang/test/Sema/riscv-vector-float32-check.c +++ b/clang/test/Sema/riscv-vector-float32-check.c @@ -6,3 +6,7 @@ vfloat32m1_t foo() { /* expected-error {{RISC-V type 'vfloat32m1_t' (aka '__rvv_float32m1_t') requires the 'zve32f' extension}} */ } /* expected-warning {{non-void function does not return a value}}*/ + +void bar(void) { + vfloat32m1_t f32m1; /* expected-error {{RISC-V type 'vfloat32m1_t' (aka '__rvv_float32m1_t') requires the 'zve32f' extension}} */ +} diff --git a/clang/test/Sema/riscv-vector-float64-check.c b/clang/test/Sema/riscv-vector-float64-check.c --- a/clang/test/Sema/riscv-vector-float64-check.c +++ b/clang/test/Sema/riscv-vector-float64-check.c @@ -6,3 +6,7 @@ vfloat64m1_t foo() { /* expected-error {{RISC-V type 'vfloat64m1_t' (aka '__rvv_float64m1_t') requires the 'zve64d' extension}} */ } /* expected-warning {{non-void function does not return a value}}*/ + +void bar(void) { + vfloat64m1_t f64m1; /* expected-error {{RISC-V type 'vfloat64m1_t' (aka '__rvv_float64m1_t') requires the 'zve64d' extension}} */ +} diff --git a/clang/test/Sema/riscv-vector-int64-check.c b/clang/test/Sema/riscv-vector-int64-check.c --- a/clang/test/Sema/riscv-vector-int64-check.c +++ b/clang/test/Sema/riscv-vector-int64-check.c @@ -6,3 +6,7 @@ vint64m1_t foo() { /* expected-error {{RISC-V type 'vint64m1_t' (aka '__rvv_int64m1_t') requires the 'zve64x' extension}} */ } /* expected-warning {{non-void function does not return a value}}*/ + +void bar(void) { + vint64m1_t i64m1; /* expected-error {{RISC-V type 'vint64m1_t' (aka '__rvv_int64m1_t') requires the 'zve64x' extension}} */ +}