[clang] d78a395 - [clang][Interp][NFC] Add two more array tests

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 22 01:20:05 PDT 2022


Author: Timm Bäder
Date: 2022-10-22T10:19:42+02:00
New Revision: d78a3957ea35eda2a50530d7afed9c7cc30a0d18

URL: https://github.com/llvm/llvm-project/commit/d78a3957ea35eda2a50530d7afed9c7cc30a0d18
DIFF: https://github.com/llvm/llvm-project/commit/d78a3957ea35eda2a50530d7afed9c7cc30a0d18.diff

LOG: [clang][Interp][NFC] Add two more array tests

Added: 
    

Modified: 
    clang/test/AST/Interp/arrays.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/Interp/arrays.cpp b/clang/test/AST/Interp/arrays.cpp
index d41999414f5b6..1269e9dbb2b14 100644
--- a/clang/test/AST/Interp/arrays.cpp
+++ b/clang/test/AST/Interp/arrays.cpp
@@ -87,16 +87,18 @@ static_assert(DI[1] == 50, "");
 static_assert(DI[2] == 30, "");
 static_assert(DI[3] == 40, "");
 
-/// FIXME: The example below tests ImplicitValueInitExprs, but we can't
-///   currently evaluate other parts of it.
-#if 0
+constexpr int addThreeElements(const int v[3]) {
+  return v[0] + v[1] + v[2];
+}
+constexpr int is[] = {10, 20, 30 };
+static_assert(addThreeElements(is) == 60);
+
 struct fred {
   char s [6];
   int n;
 };
 
 struct fred y [] = { [0] = { .s[0] = 'q' } };
-#endif
 #pragma clang diagnostic pop
 
 namespace indices {


        


More information about the cfe-commits mailing list