public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Mark experimental::net::system_context ctor deleted
@ 2020-04-23 20:09 Thomas Rodgers
  2020-04-23 20:23 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Rodgers @ 2020-04-23 20:09 UTC (permalink / raw)
  To: gcc-patches, libstdc++


      * include/experimental/net/executor: Mark
      system_context::system_context() = default.
      * testsuite/experimental/net/executor/1.cc: Add new
      test for deleted system_context ::system_context().
---
 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

 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Mark experimental::net::system_context ctor deleted
  2020-04-23 20:09 [PATCH] Mark experimental::net::system_context ctor deleted Thomas Rodgers
@ 2020-04-23 20:23 ` Jonathan Wakely
  2020-04-23 21:04   ` Thomas Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2020-04-23 20:23 UTC (permalink / raw)
  To: Thomas Rodgers; +Cc: gcc-patches, libstdc++

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
>
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Mark experimental::net::system_context ctor deleted
  2020-04-23 20:23 ` Jonathan Wakely
@ 2020-04-23 21:04   ` Thomas Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Rodgers @ 2020-04-23 21:04 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches, libstdc++

Tested x86_64_linux.
Commited to master, backported to releases/gcc-9.

Jonathan Wakely writes:

> 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
>>
>>
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-23 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 20:09 [PATCH] Mark experimental::net::system_context ctor deleted Thomas Rodgers
2020-04-23 20:23 ` Jonathan Wakely
2020-04-23 21:04   ` Thomas Rodgers

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).