libstdc++, coroutine: Add missing constexpr markers.

Message ID 528A181B-5968-4D6F-B330-602CBE1E1B06@sandoe.co.uk
State New
Headers show
Series
  • libstdc++, coroutine: Add missing constexpr markers.
Related show

Commit Message

Iain Sandoe July 17, 2020, 9:05 a.m.
Hi

As per http://eel.is/c++draft/coroutine.trivial.awaitables the methods for
the trivial awaitables are supposed to be constexpr.

tested on x86_64-linux, darwin powerpc64-linux,
OK for master?

for 10.3?

thanks
Iain

-------


The methods of the trivial awaitables are intended to
be constexpr.

libstdc++-v3/ChangeLog:

	* include/std/coroutine: Mark the methods of the
	trivial awaitables as constexpr.
---
 libstdc++-v3/include/std/coroutine | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.24.1

Comments

Bill Schmidt via Gcc-patches July 17, 2020, 9:22 a.m. | #1
On 17/07/20 10:05 +0100, Iain Sandoe wrote:
>Hi

>

>As per http://eel.is/c++draft/coroutine.trivial.awaitables the methods for

>the trivial awaitables are supposed to be constexpr.

>

>tested on x86_64-linux, darwin powerpc64-linux,

>OK for master?

>

>for 10.3?


OK for both, thanks.

Patch

diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/std/coroutine
index b40a3bcf9cc..468d1107557 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -273,20 +273,20 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// [coroutine.trivial.awaitables]
   struct suspend_always
   {
-    bool await_ready() { return false; }
+    constexpr bool await_ready() const noexcept { return false; }
 
-    void await_suspend(coroutine_handle<>) {}
+    constexpr void await_suspend(coroutine_handle<>) const noexcept {}
 
-    void await_resume() {}
+    constexpr void await_resume() const noexcept {}
   };
 
   struct suspend_never
   {
-    bool await_ready() { return true; }
+    constexpr bool await_ready() const noexcept { return true; }
 
-    void await_suspend(coroutine_handle<>) {}
+    constexpr void await_suspend(coroutine_handle<>) const noexcept {}
 
-    void await_resume() {}
+    constexpr void await_resume() const noexcept {}
   };
 
   } // namespace __n4861