Skip to content

Commit

Permalink
Use <generator> instead of <experimental/generator>
Browse files Browse the repository at this point in the history
GCC 14 adds support for std::generator to coroutines.

See: https://www.meetingcpp.com/blog/items/What-brings-an-upgrade-to-GCC-14-from-GCC-13-.html
  • Loading branch information
rmisev committed Sep 30, 2024
1 parent ed47482 commit 5219514
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
cmake_options: "-DUPA_TEST_VALGRIND=ON"
install: "valgrind"

- name: g++-14 C++23
cxx_compiler: g++-14
cxx_standard: 23
cmake_options: ""

- name: g++-12 C++20
cxx_compiler: g++-12
cxx_standard: 20
Expand Down
19 changes: 7 additions & 12 deletions test/test-url_search_params.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2023 Rimas Misevičius
// Copyright 2016-2024 Rimas Misevičius
// Distributed under the BSD-style license that can be
// found in the LICENSE file.
//
Expand All @@ -14,23 +14,18 @@
# include <version>
#endif

#if defined(__cpp_impl_coroutine)
#if __has_include(<experimental/generator>)
# include <experimental/generator>
// Use libc++ or the Microsoft C++ Standard Library to test code that
// contains coroutines and ranges when compiling with Clang
#if !defined(__clang__) || defined(_LIBCPP_VERSION) || defined(_MSC_VER)
#if defined(__cpp_lib_generator)
# include <generator>
# define TEST_COROUTINE_GENERATOR
using std::experimental::generator;
#endif
#endif

// ranges requires libc++ when compile with Clang
#if !defined(__clang__) || defined(_LIBCPP_VERSION)
#if defined(__cpp_lib_ranges)
#if __has_include(<ranges>)
# include <ranges>
# define TEST_RANGES
#endif
#endif
#endif

#endif // defined(__has_include)

Expand Down Expand Up @@ -88,7 +83,7 @@ TEST_CASE_TEMPLATE_DEFINE("Various string pairs iterable containers", CharT, tes

#ifdef TEST_COROUTINE_GENERATOR
SUBCASE("coroutine generator") {
auto pairs_gen = []() -> generator<std::pair<string_t, string_t>> {
auto pairs_gen = []() -> std::generator<std::pair<string_t, string_t>> {
const pairs_list_t<string_t> lst_pairs = TEST_ITERABLES_DATA;
for (const auto& p : lst_pairs)
co_yield p;
Expand Down

0 comments on commit 5219514

Please sign in to comment.