From 0398e15da74b888316809a30d694ae3638625552 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 20 Jul 2024 21:08:46 +0200 Subject: [PATCH] This is a combination of 2 commits. [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 +++++++-- .../syncstream.syncbuf.cons/cons.default.pass.cpp | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv index 9c65ff9a53640..e5d2498473ecd 100644 --- a/libcxx/docs/Status/Cxx20Issues.csv +++ b/libcxx/docs/Status/Cxx20Issues.csv @@ -172,7 +172,7 @@ "`LWG3221 `__","Result of ``year_month``\ arithmetic with ``months``\ is ambiguous","2019-11 (Belfast)","|Complete|","8.0","" "`LWG3235 `__","``parse``\ manipulator without abbreviation is not callable","2019-11 (Belfast)","","","" "`LWG3246 `__","LWG3246: What are the constraints on the template parameter of `basic_format_arg`?","2019-11 (Belfast)","|Nothing To Do|","","" -"`LWG3253 `__","``basic_syncbuf::basic_syncbuf()``\ should not be explicit","2019-11 (Belfast)","","","" +"`LWG3253 `__","``basic_syncbuf::basic_syncbuf()``\ should not be explicit","2019-11 (Belfast)","|Complete|","20.0","" "`LWG3245 `__","Unnecessary restriction on ``'%p'``\ parse specifier","2019-11 (Belfast)","","","" "`LWG3244 `__","Constraints for ``Source``\ in |sect|\ [fs.path.req] insufficiently constrainty","2019-11 (Belfast)","","","" "`LWG3241 `__","``chrono-spec``\ grammar ambiguity in |sect|\ [time.format]","2019-11 (Belfast)","|Complete|","16.0","" 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; // [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) 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 +std::basic_syncbuf lwg3253_default_constructor_is_not_explicit() { + return {}; +} + template void test() { + lwg3253_default_constructor_is_not_explicit(); + { using Buf = std::basic_syncbuf; static_assert(std::default_initializable);