[PATCH] Mark experimental::net::system_context ctor deleted

Jonathan Wakely jwakely@redhat.com
Thu Apr 23 20:23:42 GMT 2020


On 23/04/20 13:09 -0700, Thomas Rodgers via Libstdc++ wrote:
>
>      * include/experimental/net/executor: Mark
>      system_context::system_context() = default.

s/default/delete/ :-)

But the affected function/type/thingie should be named in parens, not
in the comment i.e.

	* include/experimental/net/executor (system_context): Define default
         constructor as deleted.

>      * testsuite/experimental/net/executor/1.cc: Add new
>      test for deleted system_context ::system_context().

There's a stray space in there.

It would be more accurate to say "check system_context isn't default
constructible" because you can't test if it's deleted, as opposed to
private or just doesn't exist.

OK with those changelog tweaks.

Please backport to gcc-9 too.



>---
> libstdc++-v3/include/experimental/executor            | 2 +-
> libstdc++-v3/testsuite/experimental/net/executor/1.cc | 7 +++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
>index b5c6e18a19a..fa39eaa0468 100644
>--- a/libstdc++-v3/include/experimental/executor
>+++ b/libstdc++-v3/include/experimental/executor
>@@ -850,7 +850,7 @@ inline namespace v1
>
>     // construct / copy / destroy:
>
>-    system_context() = default;
>+    system_context() = delete;
>     system_context(const system_context&) = delete;
>     system_context& operator=(const system_context&) = delete;
>
>diff --git a/libstdc++-v3/testsuite/experimental/net/executor/1.cc b/libstdc++-v3/testsuite/experimental/net/executor/1.cc
>index 456d620e193..cd0af4b7737 100644
>--- a/libstdc++-v3/testsuite/experimental/net/executor/1.cc
>+++ b/libstdc++-v3/testsuite/experimental/net/executor/1.cc
>@@ -85,9 +85,16 @@ test02()
>   VERIFY( e == g );
> }
>
>+void
>+test03()
>+{
>+  static_assert( ! std::is_default_constructible<net::system_context>::value, "" );
>+}
>+
> int
> main()
> {
>   test01();
>   test02();
>+  test03();
> }
>-- 
>2.25.3
>
>
>



More information about the Libstdc++ mailing list