Now that GCC 10 is out it seems time. People can still choose to disable coroutines with -fno-coroutines.
This also switches the coroutines testsuite to run in C++20 mode. The change to coro.h is needed for co-await-11-forwarding.C; we could alternatively #include <utility> just in that file. Iain, does this make sense to you? gcc/c-family/ChangeLog 2020-05-14 Jason Merrill <ja...@redhat.com> * c-opts.c (set_std_cxx20): Set flag_coroutines. gcc/testsuite/ChangeLog 2020-05-14 Jason Merrill <ja...@redhat.com> * g++.dg/coroutines/coro.h: Always #include <utility>. * g++.dg/coroutines/coroutines.exp (DEFAULT_COROFLAGS): Use -std=c++20. --- gcc/testsuite/g++.dg/coroutines/coro.h | 10 ++-------- gcc/c-family/c-opts.c | 7 ++++--- gcc/testsuite/g++.dg/coroutines/coroutines.exp | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/g++.dg/coroutines/coro.h b/gcc/testsuite/g++.dg/coroutines/coro.h index fccfe418616..02d26602727 100644 --- a/gcc/testsuite/g++.dg/coroutines/coro.h +++ b/gcc/testsuite/g++.dg/coroutines/coro.h @@ -2,20 +2,12 @@ #include <coroutine> -# if __clang__ -# include <utility> -# endif - namespace coro = std; #elif __has_include(<experimental/coroutine>) #include <experimental/coroutine> -# if __clang__ -# include <utility> -# endif - namespace coro = std::experimental; #else @@ -143,6 +135,8 @@ extern "C" int printf (const char *, ...); #include <cstdlib> /* for abort () */ +#include <utility> /* for std::forward */ + #ifndef OUTPUT # define PRINT(X) # define PRINTF (void) diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index bd617d3df18..7695e88c130 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1722,7 +1722,7 @@ set_std_cxx17 (int iso) lang_hooks.name = "GNU C++17"; } -/* Set the C++ 202a draft standard (without GNU extensions if ISO). */ +/* Set the C++ 2020 standard (without GNU extensions if ISO). */ static void set_std_cxx20 (int iso) { @@ -1734,9 +1734,10 @@ set_std_cxx20 (int iso) flag_isoc94 = 1; flag_isoc99 = 1; flag_isoc11 = 1; - /* C++20 includes concepts. */ + /* C++20 includes coroutines. */ + flag_coroutines = true; cxx_dialect = cxx20; - lang_hooks.name = "GNU C++17"; /* Pretend C++17 until standardization. */ + lang_hooks.name = "GNU C++20"; } /* Args to -d specify what to dump. Silently ignore diff --git a/gcc/testsuite/g++.dg/coroutines/coroutines.exp b/gcc/testsuite/g++.dg/coroutines/coroutines.exp index e7fd4dac461..1bef98ae54d 100644 --- a/gcc/testsuite/g++.dg/coroutines/coroutines.exp +++ b/gcc/testsuite/g++.dg/coroutines/coroutines.exp @@ -29,7 +29,7 @@ if ![info exists DEFAULT_CXXFLAGS] then { } set DEFAULT_COROFLAGS $DEFAULT_CXXFLAGS -lappend DEFAULT_COROFLAGS "-std=c++17" "-fcoroutines" +lappend DEFAULT_COROFLAGS "-std=c++20" dg-init base-commit: 4e1592f8e1d6366699e05c0824fc3dc39ca7314b -- 2.18.1