[libcxx-commits] [libcxx] [libc++] Fix use of static in constexpr (PR #175667)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 12 15:06:48 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Prabhu Rajasekaran (Prabhuk)
<details>
<summary>Changes</summary>
static is not allowed inside constexpr functions in C++ versions below
23. This is causing a build error when compiled with GCC and warning
when compiled with Clang. This patch fixes this.
---
Full diff: https://github.com/llvm/llvm-project/pull/175667.diff
1 Files Affected:
- (modified) libcxx/include/__algorithm/equal.h (+1-1)
``````````diff
diff --git a/libcxx/include/__algorithm/equal.h b/libcxx/include/__algorithm/equal.h
index 957cc29759424..753cac5a469e4 100644
--- a/libcxx/include/__algorithm/equal.h
+++ b/libcxx/include/__algorithm/equal.h
@@ -247,7 +247,7 @@ equal(_InputIterator1 __first1,
_InputIterator2 __first2,
_InputIterator2 __last2,
_BinaryPredicate __pred) {
- static constexpr bool __both_random_access =
+ constexpr bool __both_random_access =
__has_random_access_iterator_category<_InputIterator1>::value &&
__has_random_access_iterator_category<_InputIterator2>::value;
if constexpr (__both_random_access) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/175667
More information about the libcxx-commits
mailing list