[libcxx-commits] [libcxx] [libc++][syncbuf] Implements LWG3253. (PR #99778)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 30 10:57:22 PDT 2024
https://github.com/mordante updated https://github.com/llvm/llvm-project/pull/99778
>From 8be9fd5a83d1ba29b7a507e1b21931d5cf77a145 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Sat, 20 Jul 2024 21:08:46 +0200
Subject: [PATCH 1/2] [libc++][syncbuf] Implements LWG3253.
Note the tests already tested this behaviour and the wording change is NFC.
Implements
- LWG3253 basic_syncbuf::basic_syncbuf() should not be explicit
---
libcxx/docs/Status/Cxx20Issues.csv | 2 +-
libcxx/include/syncstream | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv
index 97ecf5e8e05a0..6ec441a836f0d 100644
--- a/libcxx/docs/Status/Cxx20Issues.csv
+++ b/libcxx/docs/Status/Cxx20Issues.csv
@@ -172,7 +172,7 @@
"`3221 <https://wg21.link/LWG3221>`__","Result of ``year_month``\ arithmetic with ``months``\ is ambiguous","Belfast","|Complete|","8.0"
"`3235 <https://wg21.link/LWG3235>`__","``parse``\ manipulator without abbreviation is not callable","Belfast","",""
"`3246 <https://wg21.link/LWG3246>`__","What are the constraints on the template parameter of ``basic_format_arg``\ ?","Belfast","","","|format|"
-"`3253 <https://wg21.link/LWG3253>`__","``basic_syncbuf::basic_syncbuf()``\ should not be explicit","Belfast","",""
+"`3253 <https://wg21.link/LWG3253>`__","``basic_syncbuf::basic_syncbuf()``\ should not be explicit","Belfast","|Complete|","20.0"
"`3245 <https://wg21.link/LWG3245>`__","Unnecessary restriction on ``'%p'``\ parse specifier","Belfast","","","|chrono|"
"`3244 <https://wg21.link/LWG3244>`__","Constraints for ``Source``\ in |sect|\ [fs.path.req] insufficiently constrainty","Belfast","",""
"`3241 <https://wg21.link/LWG3241>`__","``chrono-spec``\ grammar ambiguity in |sect|\ [time.format]","Belfast","|Complete|","16.0","|chrono| |format|"
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index e6f35b6f428ed..a0617f4acf5b6 100644
--- a/libcxx/include/syncstream
+++ b/libcxx/include/syncstream
@@ -46,7 +46,9 @@ namespace std {
using streambuf_type = basic_streambuf<charT, traits>;
// [syncstream.syncbuf.cons], construction and destruction
- explicit basic_syncbuf(streambuf_type* obuf = nullptr)
+ basic_syncbuf()
+ : basic_syncbuf(nullptr) {}
+ explicit basic_syncbuf(streambuf_type* obuf)
: basic_syncbuf(obuf, Allocator()) {}
basic_syncbuf(streambuf_type*, const Allocator&);
basic_syncbuf(basic_syncbuf&&);
@@ -253,7 +255,10 @@ public:
// [syncstream.syncbuf.cons], construction and destruction
- _LIBCPP_HIDE_FROM_ABI explicit basic_syncbuf(streambuf_type* __obuf = nullptr)
+ _LIBCPP_HIDE_FROM_ABI basic_syncbuf()
+ : basic_syncbuf(nullptr) {}
+
+ _LIBCPP_HIDE_FROM_ABI explicit basic_syncbuf(streambuf_type* __obuf)
: basic_syncbuf(__obuf, _Allocator()) {}
_LIBCPP_HIDE_FROM_ABI basic_syncbuf(streambuf_type* __obuf, _Allocator const& __alloc)
>From ff22196ca5c4da9b4a63a6dab6f597048815f5e2 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Tue, 30 Jul 2024 19:57:11 +0200
Subject: [PATCH 2/2] Addresses review comment.
---
.../syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp b/libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp
index aa0eb2d41e0f0..beebc36c76758 100644
--- a/libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp
+++ b/libcxx/test/std/input.output/syncstream/syncbuf/syncstream.syncbuf.cons/cons.default.pass.cpp
@@ -25,8 +25,15 @@
#include "constexpr_char_traits.h"
#include "test_allocator.h"
+template <class CharT>
+std::basic_syncbuf<CharT> lwg3253_default_constructor_is_not_explicit() {
+ return {};
+}
+
template <class CharT>
void test() {
+ lwg3253_default_constructor_is_not_explicit<CharT>();
+
{
using Buf = std::basic_syncbuf<CharT>;
static_assert(std::default_initializable<Buf>);
More information about the libcxx-commits
mailing list