From 7cc2c8c5cb049f68beede296520a6985844550ef Mon Sep 17 00:00:00 2001 From: Jakub Mazurkiewicz Date: Sun, 12 Feb 2023 01:34:43 +0100 Subject: [PATCH 1/2] Implement LWG-3810 --- stl/inc/format | 3 +++ .../tests/P0645R10_text_formatting_args/test.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/stl/inc/format b/stl/inc/format index 1e7feb962c5..a8e6af79f9e 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -1991,6 +1991,9 @@ private: const _Format_arg_index* _Index_array = nullptr; }; +template +basic_format_args(_Format_arg_store<_Context, _Args...>) -> basic_format_args<_Context>; + // _Lazy_locale is used instead of a std::locale so that the locale is only // constructed when needed, and is never constructed if the format string does not // contain locale-sensitive format specifiers. Note that this means that a new locale diff --git a/tests/std/tests/P0645R10_text_formatting_args/test.cpp b/tests/std/tests/P0645R10_text_formatting_args/test.cpp index 85a1784d7bc..09ed8abd40b 100644 --- a/tests/std/tests/P0645R10_text_formatting_args/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_args/test.cpp @@ -229,6 +229,19 @@ void test_visit_monostate() { assert(visit_format_arg(visitor, basic_format_arg()) == Arg_type::none); } +template +constexpr bool verify_lwg3810 = false; + +template +constexpr bool verify_lwg3810> = true; + +template +void test_lwg3810() { + auto args_store = make_format_args(1, 2, 3); + [[maybe_unused]] basic_format_args args = args_store; + static_assert(verify_lwg3810); +} + int main() { test_basic_format_arg(); test_basic_format_arg(); @@ -236,4 +249,6 @@ int main() { test_format_arg_store(); test_visit_monostate(); test_visit_monostate(); + test_lwg3810(); + test_lwg3810(); } From 9e22d248eee27d119caaf5ddb3818b6f989b8b82 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 13 Feb 2023 09:46:36 -0800 Subject: [PATCH 2/2] Simplify CTAD test. Co-authored-by: Casey Carter --- .../std/tests/P0645R10_text_formatting_args/test.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/std/tests/P0645R10_text_formatting_args/test.cpp b/tests/std/tests/P0645R10_text_formatting_args/test.cpp index 09ed8abd40b..d4b3024df32 100644 --- a/tests/std/tests/P0645R10_text_formatting_args/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_args/test.cpp @@ -229,17 +229,10 @@ void test_visit_monostate() { assert(visit_format_arg(visitor, basic_format_arg()) == Arg_type::none); } -template -constexpr bool verify_lwg3810 = false; - -template -constexpr bool verify_lwg3810> = true; - template void test_lwg3810() { - auto args_store = make_format_args(1, 2, 3); - [[maybe_unused]] basic_format_args args = args_store; - static_assert(verify_lwg3810); + [[maybe_unused]] auto args_store = make_format_args(1, 2, 3); + static_assert(same_as>); } int main() {