libstdc++: Fix a few !HOSTED test regressions
libstdc++-v3/ChangeLog: * testsuite/20_util/to_chars/version.cc: Mark hosted-only. * testsuite/20_util/uses_allocator/lwg3677.cc: Ditto. * testsuite/20_util/weak_ptr/cons/self_move.cc: Ditto. * testsuite/std/ranges/adaptors/as_rvalue/1.cc: Replace usage of std::make_unique with a freestanding-compatible wrapper around unique_ptr. * testsuite/21_strings/basic_string_view/operations/contains/char.cc: Don't test for presence of __cpp_lib_string_contains on !HOSTED. * testsuite/21_strings/basic_string_view/operations/contains/char/2.cc: Ditto. * testsuite/std/ranges/version_c++23.cc: Don't test for presence of __cpp_lib_ranges in !HOSTED.
This commit is contained in:
parent
42d3f74323
commit
450eb6b3b5
7 changed files with 37 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
|||
// { dg-options "-std=gnu++23" }
|
||||
// { dg-do preprocess { target c++23 } }
|
||||
// { dg-require-effective-target hosted }
|
||||
|
||||
#include <version>
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// { dg-options "-std=gnu++23" }
|
||||
// { dg-do run { target c++20 } }
|
||||
// { dg-require-effective-target hosted }
|
||||
|
||||
#include <memory>
|
||||
#include <testsuite_hooks.h>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// { dg-do run { target c++11 } }
|
||||
// { dg-require-effective-target hosted }
|
||||
|
||||
#include <memory>
|
||||
#include <testsuite_hooks.h>
|
||||
|
|
|
@ -22,11 +22,14 @@
|
|||
|
||||
#include <string_view>
|
||||
|
||||
#ifndef __cpp_lib_string_contains
|
||||
# error "Feature-test macro for contains missing in <string_view>"
|
||||
#elif __cpp_lib_string_contains != 202011L
|
||||
# error "Feature-test macro for contains has wrong value in <string_view>"
|
||||
#endif
|
||||
#if __STDC_HOSTED__
|
||||
// This FTM is omitted since <string> is not freestanding.
|
||||
# ifndef __cpp_lib_string_contains
|
||||
# error "Feature-test macro for contains missing in <string_view>"
|
||||
# elif __cpp_lib_string_contains != 202011L
|
||||
# error "Feature-test macro for contains has wrong value in <string_view>"
|
||||
# endif
|
||||
#endif // HOSTED
|
||||
|
||||
void
|
||||
test01()
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
|
||||
#include <version>
|
||||
|
||||
#ifndef __cpp_lib_string_contains
|
||||
# error "Feature-test macro for contains missing in <string_view>"
|
||||
#elif __cpp_lib_string_contains != 202011L
|
||||
# error "Feature-test macro for contains has wrong value in <string_view>"
|
||||
#if __STDC_HOSTED__
|
||||
// This FTM is omitted since <string> is not freestanding.
|
||||
# ifndef __cpp_lib_string_contains
|
||||
# error "Feature-test macro for contains missing in <string_view>"
|
||||
# elif __cpp_lib_string_contains != 202011L
|
||||
# error "Feature-test macro for contains has wrong value in <string_view>"
|
||||
# endif
|
||||
#endif
|
||||
|
|
|
@ -14,13 +14,24 @@
|
|||
namespace ranges = std::ranges;
|
||||
namespace views = std::views;
|
||||
|
||||
|
||||
/* Replacement for the standard version, as it's not available in freestanding
|
||||
environments. */
|
||||
template<typename T, typename... Args>
|
||||
requires (!std::is_array_v<T>)
|
||||
constexpr auto
|
||||
make_unique (Args &&...args)
|
||||
{
|
||||
return std::unique_ptr<T> { new T (std::forward<Args>(args)...) };
|
||||
}
|
||||
|
||||
constexpr bool
|
||||
test01()
|
||||
{
|
||||
|
||||
std::unique_ptr<int> a[3] = { std::make_unique<int>(1),
|
||||
std::make_unique<int>(2),
|
||||
std::make_unique<int>(3) };
|
||||
std::unique_ptr<int> a[3] = { make_unique<int>(1),
|
||||
make_unique<int>(2),
|
||||
make_unique<int>(3) };
|
||||
std::unique_ptr<int> b[3];
|
||||
auto v = a | views::as_rvalue;
|
||||
ranges::copy(v, b);
|
||||
|
@ -33,7 +44,7 @@ test01()
|
|||
void
|
||||
test02()
|
||||
{
|
||||
std::unique_ptr<int> x = std::make_unique<int>(42);
|
||||
std::unique_ptr<int> x = make_unique<int>(42);
|
||||
std::unique_ptr<int> y;
|
||||
__gnu_test::test_input_range rx(&x, &x+1);
|
||||
auto v = rx | views::as_rvalue;
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
|
||||
#include <version>
|
||||
|
||||
#if __cpp_lib_ranges != 202110L
|
||||
# error "Feature-test macro __cpp_lib_ranges has wrong value in <version>"
|
||||
#if __STDC_HOSTED__
|
||||
# if __cpp_lib_ranges != 202110L
|
||||
# error "Feature-test macro __cpp_lib_ranges has wrong value in <version>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __cpp_lib_ranges_zip != 202110L
|
||||
|
|
Loading…
Add table
Reference in a new issue