[libcxx-commits] [libcxx] [libc++] Mostly Implement P1885R12: `<text_encoding>` (PR #141312)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 25 00:02:10 PST 2026
================
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++26
+
+// <text_encoding>
+
+// text_encoding::text_encoding() noexcept
+
+#include <cassert>
+#include <concepts>
+#include <text_encoding>
+#include <type_traits>
+
+constexpr bool test() {
+ std::same_as<std::text_encoding> decltype(auto) te = std::text_encoding();
+ assert(te.mib() == std::text_encoding::unknown);
+ assert(std::string_view("") == te.name());
+
+ return true;
+}
+
+int main(int, char**) {
+ // 1. Default constructor must be nothrow
+ {
----------------
frederick-vs-ja wrote:
I think it's better to avoid redundant braces when there's no local variables defined within them. Ditto below.
https://github.com/llvm/llvm-project/pull/141312
More information about the libcxx-commits
mailing list