[libcxx-commits] [libcxx] [libc++] Fix LWG 4265: std::midpoint should not accept const bool (PR #174579)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 9 04:15:22 PST 2026


================
@@ -29,6 +29,12 @@ void* vp       = nullptr;
 void test() {
   // expected-error at +1 {{no matching function for call to 'midpoint'}}
   (void)std::midpoint(false, true);
+  // expected-error at +1 {{no matching function for call to 'midpoint'}}
+  (void)std::midpoint<const bool>(false, true);
+  // expected-error at +1 {{no matching function for call to 'midpoint'}}
+  (void)std::midpoint<const volatile bool>(false, true);
+  // expected-error at +1 {{no matching function for call to 'midpoint'}}
+  (void)std::midpoint<volatile bool>(false, true);
----------------
frederick-vs-ja wrote:

It was pre-exiting to test constraints of `midpoint` in `.verify.cpp`. I think it would be clearer to leave the refactoring in a separated PR.

https://github.com/llvm/llvm-project/pull/174579


More information about the libcxx-commits mailing list