[libcxx-commits] [libcxx] [libc++] Implements Runtime format strings II. (PR #72543)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 22 08:44:02 PST 2023
================
@@ -0,0 +1,70 @@
+//===----------------------------------------------------------------------===//
+// 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
+
+// XFAIL: availability-fp_to_chars-missing
+
+// <format>
+
+// template<class charT, class... Args>
+// struct basic_format_string {
+// ...
+// basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}
+// ...
+// }
+
+// template<class... Args>
+// string format(format_string<Args...> fmt, const Args&... args);
+// template<class... Args>
+// wstring format(wformat_string<Args...> fmt, const Args&... args);
+
+#include <format>
+#include <cassert>
+#include <vector>
+
+#include "test_macros.h"
+#include "format_tests.h"
+#include "string_literal.h"
+#include "assert_macros.h"
+#include "concat_macros.h"
+
+auto test = []<class CharT, class... Args>(
+ std::basic_string_view<CharT> expected, std::basic_string_view<CharT> fmt, Args&&... args) constexpr {
+ std::basic_string<CharT> out = std::format(std::runtime_format(fmt), std::forward<Args>(args)...);
----------------
mordante wrote:
This is done in the synopsis test. I've added some comments referring to other tests.
https://github.com/llvm/llvm-project/pull/72543
More information about the libcxx-commits
mailing list