[libcxx-commits] [libcxx] [libc++][format] P2637R3: Member `visit` (`std::basic_format_arg`) (PR #76449)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sat Dec 30 04:28:15 PST 2023


================
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+
+// <format>
+
+// template<class Visitor, class Context>
+//   see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg);
+
+#include <format>
+
+void test() {
+  // expected-warning at +1 {{std::basic_format_context<char *, char>>' is deprecated}}
+  std::visit_format_arg([]([[maybe_unused]] auto a) -> char { return {}; },
+                        std::basic_format_arg<std::basic_format_context<char*, char>>{});
+
----------------
mordante wrote:

Guard this code with
`#ifnef TEST_HAS_NO_WIDE_CHARACTERS`

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


More information about the libcxx-commits mailing list