https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/186773

Make sure we get the `expand()` during `computeOffsetForComparison()` right.

>From 055a5d6ad2eedc65e79a3179766c175b7bb56c12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Mon, 16 Mar 2026 11:51:34 +0100
Subject: [PATCH] [clang][bytecode][NFC] Pre-commit a test case

Make sure we get the `expand()` during `computeOffsetForComparison()`
right.
---
 clang/test/AST/ByteCode/cxx20.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/clang/test/AST/ByteCode/cxx20.cpp 
b/clang/test/AST/ByteCode/cxx20.cpp
index 139b6c873adce..9800fe01fcaf5 100644
--- a/clang/test/AST/ByteCode/cxx20.cpp
+++ b/clang/test/AST/ByteCode/cxx20.cpp
@@ -1304,3 +1304,30 @@ namespace PointerCmp {
   static_assert((void*)(&a.i + 1) != (void*)(&a.i[1])); // expected-error 
{{static assertion failed}}
   static_assert((void*)(&a.i[2] + 1) == (void*)(&a.i[3]));
 }
+
+namespace ExpandOnOPTEPointers {
+
+  template <class _BidirectionalIterator>
+  constexpr void inplace_merge(_BidirectionalIterator __first,
+                               _BidirectionalIterator __middle) {
+
+    if (__first != __middle)
+      ++__first;
+  }
+  template <class> struct bidirectional_iterator {
+    int *it_;
+    constexpr void operator++() { ++it_; }
+
+    friend constexpr bool operator!=(bidirectional_iterator x,
+                                     bidirectional_iterator y) {
+      return x.it_ != y.it_;
+    }
+  };
+  constexpr bool test() {
+    int *ia = new int[0];
+    inplace_merge(bidirectional_iterator<int *>(ia), 
bidirectional_iterator<int *>(ia + 0));
+    delete[] ia;
+    return true;
+  }
+  static_assert(test());
+}

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

Reply via email to