Louis Dionne 6900df37d2 [libc++] Remove Lit annotations for unsupported GCC versions from the test suite
Since we officially don't support several older compilers now, we can
drop a lot of the markup in the test suite. This helps keep the test
suite simple and makes sure that UNSUPPORTED annotations don't rot.

This is the first patch of a series that will remove annotations for
compilers that are now unsupported.

Differential Revision: https://reviews.llvm.org/D107787
2021-08-12 13:30:47 -04:00

60 lines
1.8 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-no-concepts
// UNSUPPORTED: libcpp-has-no-incomplete-ranges
// reverse_view() requires default_­initializable<V> = default;
#include <ranges>
#include <cassert>
#include "test_macros.h"
#include "types.h"
enum CtorKind { DefaultCtor, PtrCtor };
template<CtorKind CK>
struct BidirRangeWith : std::ranges::view_base {
int *ptr_ = nullptr;
constexpr BidirRangeWith() requires (CK == DefaultCtor) = default;
constexpr BidirRangeWith(int *ptr);
constexpr bidirectional_iterator<int*> begin() { return bidirectional_iterator<int*>{ptr_}; }
constexpr bidirectional_iterator<const int*> begin() const { return bidirectional_iterator<const int*>{ptr_}; }
constexpr bidirectional_iterator<int*> end() { return bidirectional_iterator<int*>{ptr_ + 8}; }
constexpr bidirectional_iterator<const int*> end() const { return bidirectional_iterator<const int*>{ptr_ + 8}; }
};
constexpr bool test() {
{
static_assert( std::default_initializable<std::ranges::reverse_view<BidirRangeWith<DefaultCtor>>>);
static_assert(!std::default_initializable<std::ranges::reverse_view<BidirRangeWith<PtrCtor>>>);
}
{
std::ranges::reverse_view<BidirRangeWith<DefaultCtor>> rev;
assert(rev.base().ptr_ == nullptr);
}
{
const std::ranges::reverse_view<BidirRangeWith<DefaultCtor>> rev;
assert(rev.base().ptr_ == nullptr);
}
return true;
}
int main(int, char**) {
test();
static_assert(test());
return 0;
}