[clang] [clang][ExprConst] allow single element access of vector object to be constant expression (PR #101126)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 10:36:39 PDT 2024
================
@@ -3,40 +3,39 @@
typedef int __attribute__((vector_size(16))) VI4;
constexpr VI4 A = {1,2,3,4};
-static_assert(A[0] == 1, ""); // ref-error {{not an integral constant expression}}
-static_assert(A[1] == 2, ""); // ref-error {{not an integral constant expression}}
-static_assert(A[2] == 3, ""); // ref-error {{not an integral constant expression}}
-static_assert(A[3] == 4, ""); // ref-error {{not an integral constant expression}}
+static_assert(A[0] == 1, "");
+static_assert(A[1] == 2, "");
+static_assert(A[2] == 3, "");
+static_assert(A[3] == 4, "");
/// FIXME: It would be nice if the note said 'vector' instead of 'array'.
----------------
tbaederr wrote:
Resolving this fixme comment would be a nice follow-up.
https://github.com/llvm/llvm-project/pull/101126
More information about the cfe-commits
mailing list