public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Remove std::formatter<const charT[N], charT> specialization
@ 2023-03-22 17:50 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-03-22 17:50 UTC (permalink / raw)
  To: libstdc++, gcc-patches

Tested powerpc64le-linux, pushed to trunk.

-- >8--

This was approved in Issaquah as LWG 3833.

libstdc++-v3/ChangeLog:

	* include/std/format (formatter<const charT[N], charT>): Do not
	define partial speclialization, as per LWG 3833.
	* testsuite/std/format/formatter/requirements.cc: Check it.
---
 libstdc++-v3/include/std/format               | 22 -------------------
 .../std/format/formatter/requirements.cc      |  9 ++++++++
 2 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 0e40bce5c15..72b6b450ad1 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1882,28 +1882,6 @@ namespace __format
       __format::__formatter_str<_CharT> _M_f;
     };
 
-  template<__format::__char _CharT, size_t _Nm>
-    struct formatter<const _CharT[_Nm], _CharT>
-    {
-      formatter() = default;
-
-      [[__gnu__::__always_inline__]]
-      constexpr typename basic_format_parse_context<_CharT>::iterator
-      parse(basic_format_parse_context<_CharT>& __pc)
-      { return _M_f.parse(__pc); }
-
-      template<typename _Out>
-	typename basic_format_context<_Out, _CharT>::iterator
-	format(const _CharT (&__u)[_Nm],
-	       basic_format_context<_Out, _CharT>& __fc) const
-	{ return _M_f.format({__u, _Nm}, __fc); }
-
-      constexpr void set_debug_format() noexcept { _M_f.set_debug_format(); }
-
-    private:
-      __format::__formatter_str<_CharT> _M_f;
-    };
-
   template<typename _Traits, typename _Alloc>
     struct formatter<basic_string<char, _Traits, _Alloc>, char>
     {
diff --git a/libstdc++-v3/testsuite/std/format/formatter/requirements.cc b/libstdc++-v3/testsuite/std/format/formatter/requirements.cc
index 3bff8bdbd5d..7d95f7fafe9 100644
--- a/libstdc++-v3/testsuite/std/format/formatter/requirements.cc
+++ b/libstdc++-v3/testsuite/std/format/formatter/requirements.cc
@@ -51,6 +51,15 @@ test_specializations() // [format.formatter.spec]
   static_assert( ! std::is_move_constructible_v<Ferr> );
   static_assert( ! std::is_copy_assignable_v<Ferr> );
   static_assert( ! std::is_move_assignable_v<Ferr> );
+
+  // LWG 3833. Remove specialization
+  // template<size_t N> struct formatter<const charT[N], charT>
+  using Farr = std::format_context::formatter_type<const char[1]>;
+  static_assert( ! std::is_default_constructible_v<Farr> );
+  static_assert( ! std::is_copy_constructible_v<Farr> );
+  static_assert( ! std::is_move_constructible_v<Farr> );
+  static_assert( ! std::is_copy_assignable_v<Farr> );
+  static_assert( ! std::is_move_assignable_v<Farr> );
 }
 
 int main()
-- 
2.39.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-22 17:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 17:50 [committed] libstdc++: Remove std::formatter<const charT[N], charT> specialization Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).