[libcxx-commits] [libcxx] [libc++] Complete overload removal in P3016R6 (PR #216932)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 18 00:53:25 PDT 2026
================
@@ -76,14 +79,20 @@ int main(int, char**)
test_const_container ( a );
test_const_container ( il );
-#if TEST_STD_VER > 14
std::string_view sv{"ABC"};
- test_container ( sv );
- test_const_container ( sv );
-#endif
+ test_container(sv);
+ test_const_container(sv);
static constexpr int arrA [] { 1, 2, 3 };
test_const_array ( arrA );
+ {
+ // Verify that the std::empty overload for std::initializer_list is absent (removed by P3016R6).
+ // The behavior of std::empty({vals...}) is unchanged because the overload for const T(&)[N] is used.
+ using p3016r6::empty;
+ using std::empty;
+ static_assert(std::is_same_v<decltype(empty({1, 2, 3})), void>);
+ }
----------------
frederick-vs-ja wrote:
I guess a possible reason might be that
- `std::empty({vals...})` is useless but also harmless (at least to me) - this unconditionally returns `true` when well-formed, which is not helpful but not misleading either, or
- the consequence of simple removal wasn't well estimated, as P3016R6 incorrectly claimed that `bool b = std::empty({1,2,3});` wouldn't compile after the removal.
https://github.com/llvm/llvm-project/pull/216932
More information about the libcxx-commits
mailing list