summaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/vectors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/AST/ByteCode/vectors.cpp')
-rw-r--r--clang/test/AST/ByteCode/vectors.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/clang/test/AST/ByteCode/vectors.cpp b/clang/test/AST/ByteCode/vectors.cpp
index 091caf8c9a27..91fec8f86f61 100644
--- a/clang/test/AST/ByteCode/vectors.cpp
+++ b/clang/test/AST/ByteCode/vectors.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both -flax-vector-conversions=none %s
-// RUN: %clang_cc1 -verify=ref,both -flax-vector-conversions=none %s
+// RUN: %clang_cc1 -Wno-c++20-extensions -fexperimental-new-constant-interpreter -verify=expected,both -flax-vector-conversions=none %s
+// RUN: %clang_cc1 -Wno-c++20-extensions -verify=ref,both -flax-vector-conversions=none %s
typedef int __attribute__((vector_size(16))) VI4;
constexpr VI4 A = {1,2,3,4};
@@ -143,3 +143,28 @@ namespace {
constexpr __m128d v_mm_cvtps_pd = _mm_cvtps_pd(kf1);
static_assert(v_mm_cvtps_pd[0] == -1.0 && v_mm_cvtps_pd[1] == +2.0);
}
+
+namespace Assign {
+ constexpr int a2() {
+ VI a = {0, 0, 0, 0};
+ VI b;
+
+ b = {1,1,1,1};
+ return b[0] + b[1] + b[2] + b[3];
+ }
+
+ static_assert(a2() == 4);
+
+ typedef short v2int16_t __attribute__((ext_vector_type(2)));
+ typedef unsigned short v2int_t __attribute__((ext_vector_type(2)));
+
+
+ constexpr bool invalid() {
+ v2int16_t a = {0, 0};
+ v2int_t b;
+ b = a; // both-error {{incompatible type}}
+
+ return true;
+ }
+ static_assert(invalid()); // both-error {{not an integral constant expression}}
+}