llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> Make sure we get the `expand()` during `computeOffsetForComparison()` right. --- Full diff: https://github.com/llvm/llvm-project/pull/186773.diff 1 Files Affected: - (modified) clang/test/AST/ByteCode/cxx20.cpp (+27) ``````````diff 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()); +} `````````` </details> https://github.com/llvm/llvm-project/pull/186773 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
