[clang] 1f4a5d8 - [clang][Interp] Fix broken test case again

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 05:41:42 PST 2024


Author: Timm Bäder
Date: 2024-02-02T14:41:25+01:00
New Revision: 1f4a5d8a5b2ba62f3d9f65bdd4a65d6f5593d4cd

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

LOG: [clang][Interp] Fix broken test case again

Instead of asserting that it's wrong, assert the correct
value.

See the discussion in
https://github.com/llvm/llvm-project/commit/a8b5994b337cf1d461202a65204a4ee6c5eae341

Added: 
    

Modified: 
    clang/test/AST/Interp/c.c

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c
index 65d83eab2ea19..53ce62fa1452e 100644
--- a/clang/test/AST/Interp/c.c
+++ b/clang/test/AST/Interp/c.c
@@ -117,13 +117,11 @@ int somefunc(int i) {
 struct ArrayStruct {
   char n[1];
 };
-struct AA {
-  char name2[(int)&((struct ArrayStruct*)0)->n - 1]; // expected-warning {{folded to constant array}} \
-                                                     // pedantic-expected-warning {{folded to constant array}} \
-                                                     // ref-error {{array size is negative}} \
-                                                     // pedantic-ref-error {{array size is negative}}
-};
-_Static_assert(sizeof(struct AA) == 15, ""); // ref-error {{failed}} \
-                                             // ref-note {{ == 15}} \
-                                             // pedantic-ref-error {{failed}} \
-                                             // pedantic-ref-note {{ == 15}}
+char name2[(int)&((struct ArrayStruct*)0)->n]; // expected-warning {{folded to constant array}} \
+                                               // pedantic-expected-warning {{folded to constant array}} \
+                                               // ref-warning {{folded to constant array}} \
+                                               // pedantic-ref-warning {{folded to constant array}}
+_Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \
+                                        // expected-note {{evaluates to}} \
+                                        // pedantic-expected-error {{failed}} \
+                                        // pedantic-expected-note {{evaluates to}}


        


More information about the cfe-commits mailing list