Author: Timm Baeder
Date: 2025-12-10T09:56:35+01:00
New Revision: 52efe037cca529ed5f8e6ec8d0978f279c829eea

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

LOG: [clang][bytecode] Enable some placement-new tests (#171567)

They used to cause problems. Use the BYTECODE define to enable them at
least for the bytecode interpreter.

Added: 
    

Modified: 
    clang/test/AST/ByteCode/placement-new.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/ByteCode/placement-new.cpp 
b/clang/test/AST/ByteCode/placement-new.cpp
index 1c015da7be54f..f458ea17b6cc6 100644
--- a/clang/test/AST/ByteCode/placement-new.cpp
+++ b/clang/test/AST/ByteCode/placement-new.cpp
@@ -68,41 +68,40 @@ consteval int ok5() {
   } s;
   new (&s) S[1]{{12, 13}};
 
+  /// FIXME: Broken in the current interpreter.
+#if BYTECODE
+  return s.a + s.b;
+#else
   return 25;
-  // return s.a + s.b; FIXME: Broken in the current interpreter.
+#endif
 }
 static_assert(ok5() == 25);
 
-/// FIXME: Broken in both interpreters.
-#if 0
-consteval int ok5() {
+consteval int ok6() {
+    int i[2];
+    new (i) int(100);
+    new (i + 1) int(200);
+    return i[0] + i[1];
+}
+static_assert(ok6() == 300);
+
+/// FIXME: Broken in the current interpreter.
+#if BYTECODE
+consteval int ok7() {
     int i;
-    new (&i) int[1]{1}; // expected-note {{assignment to dereferenced 
one-past-the-end pointer}}
+    new (&i) int[1]{1};
     return i;
 }
-static_assert(ok5() == 1); // expected-error {{not an integral constant 
expression}} \
-                           // expected-note {{in call to}}
-#endif
+static_assert(ok7() == 1);
 
-/// FIXME: Crashes the current interpreter.
-#if 0
-consteval int ok6() {
+consteval int ok8() {
     int i[2];
     new (&i) int(100);
     return i[0];
 }
-static_assert(ok6() == 100);
+static_assert(ok8() == 100);
 #endif
 
-consteval int ok6() {
-    int i[2];
-    new (i) int(100);
-    new (i + 1) int(200);
-    return i[0] + i[1];
-}
-static_assert(ok6() == 300);
-
-
 consteval auto fail1() {
   int b;
   new (&b) float(1.0); // both-note {{placement new would change type of 
storage from 'int' to 'float'}}


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to