mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
[libc++] Extend check for non-ASCII characters to src/, test/ and benchmarks/
Differential Revision: https://reviews.llvm.org/D132180
This commit is contained in:
parent
89469df8ba
commit
355e0ce3c5
@ -49,8 +49,8 @@ struct AllOrders : EnumValuesAsTuple<AllOrders, Order, 7> {
|
||||
// These values are arranged in such a way that they would invoke O(N^2)
|
||||
// behavior on any quick sort implementation that satisifies certain conditions.
|
||||
// Details are available in the following paper:
|
||||
// "A Killer Adversary for Quicksort", M. D. McIlroy, Software—Practice &
|
||||
// ExperienceVolume 29 Issue 4 April 10, 1999 pp 341–344.
|
||||
// "A Killer Adversary for Quicksort", M. D. McIlroy, Software-Practice &
|
||||
// Experience Volume 29 Issue 4 April 10, 1999 pp 341-344.
|
||||
// https://dl.acm.org/doi/10.5555/311868.311871.
|
||||
template <class T>
|
||||
void fillAdversarialQuickSortInput(T& V, size_t N) {
|
||||
|
@ -203,7 +203,7 @@ struct Precision<PrecisionE::Small> {
|
||||
|
||||
template <>
|
||||
struct Precision<PrecisionE::Huge> {
|
||||
// The maximum precision for a minimal sub normal long double is ±0x1p-16494.
|
||||
// The maximum precision for a minimal sub normal long double is +/- 0x1p-16494.
|
||||
// This value is always larger than that value forcing the trailing zero path
|
||||
// to be executed.
|
||||
static constexpr const char* fmt = ".17000";
|
||||
|
@ -52,11 +52,11 @@ static void __libcpp_platform_wake_by_address(__cxx_atomic_contention_t const vo
|
||||
#elif defined(__APPLE__) && defined(_LIBCPP_USE_ULOCK)
|
||||
|
||||
extern "C" int __ulock_wait(uint32_t operation, void *addr, uint64_t value,
|
||||
uint32_t timeout); /* timeout is specified in microseconds */
|
||||
uint32_t timeout); /* timeout is specified in microseconds */
|
||||
extern "C" int __ulock_wake(uint32_t operation, void *addr, uint64_t wake_value);
|
||||
|
||||
#define UL_COMPARE_AND_WAIT 1
|
||||
#define ULF_WAKE_ALL 0x00000100
|
||||
#define UL_COMPARE_AND_WAIT 1
|
||||
#define ULF_WAKE_ALL 0x00000100
|
||||
|
||||
static void __libcpp_platform_wait_on_address(__cxx_atomic_contention_t const volatile* __ptr,
|
||||
__cxx_contention_t __val)
|
||||
|
@ -21,13 +21,13 @@ namespace __itoa
|
||||
_LIBCPP_FUNC_VIS char*
|
||||
__u32toa(uint32_t value, char* buffer) noexcept
|
||||
{
|
||||
return __base_10_u32(buffer, value);
|
||||
return __base_10_u32(buffer, value);
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS char*
|
||||
__u64toa(uint64_t value, char* buffer) noexcept
|
||||
{
|
||||
return __base_10_u64(buffer, value);
|
||||
return __base_10_u64(buffer, value);
|
||||
}
|
||||
|
||||
} // namespace __itoa
|
||||
|
@ -145,11 +145,11 @@ int ios_base::__xindex_ = 0;
|
||||
template <typename _Tp>
|
||||
static size_t __ios_new_cap(size_t __req_size, size_t __current_cap)
|
||||
{ // Precondition: __req_size > __current_cap
|
||||
const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
|
||||
if (__req_size < mx/2)
|
||||
return _VSTD::max(2 * __current_cap, __req_size);
|
||||
else
|
||||
return mx;
|
||||
const size_t mx = std::numeric_limits<size_t>::max() / sizeof(_Tp);
|
||||
if (__req_size < mx/2)
|
||||
return _VSTD::max(2 * __current_cap, __req_size);
|
||||
else
|
||||
return mx;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -109,8 +109,8 @@ static void force_locale_initialization() {
|
||||
|
||||
class DoIOSInit {
|
||||
public:
|
||||
DoIOSInit();
|
||||
~DoIOSInit();
|
||||
DoIOSInit();
|
||||
~DoIOSInit();
|
||||
};
|
||||
|
||||
DoIOSInit::DoIOSInit()
|
||||
|
@ -4805,7 +4805,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
|
||||
{
|
||||
// if the grouping pattern is empty _or_ there are no grouping bits, then do nothing
|
||||
// we always have at least a single entry in [__g, __g_end); the end of the input sequence
|
||||
if (__grouping.size() != 0 && __g_end - __g > 1)
|
||||
if (__grouping.size() != 0 && __g_end - __g > 1)
|
||||
{
|
||||
reverse(__g, __g_end);
|
||||
const char* __ig = __grouping.data();
|
||||
@ -4838,7 +4838,7 @@ __num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd,
|
||||
if ((__flags & ios_base::showpos) &&
|
||||
(__flags & ios_base::basefield) != ios_base::oct &&
|
||||
(__flags & ios_base::basefield) != ios_base::hex &&
|
||||
__signd)
|
||||
__signd)
|
||||
*__fmtp++ = '+';
|
||||
if (__flags & ios_base::showbase)
|
||||
*__fmtp++ = '#';
|
||||
|
@ -16,7 +16,7 @@ bad_optional_access::~bad_optional_access() noexcept = default;
|
||||
|
||||
const char* bad_optional_access::what() const noexcept {
|
||||
return "bad_optional_access";
|
||||
}
|
||||
}
|
||||
|
||||
} // std
|
||||
|
||||
@ -28,13 +28,13 @@ const char* bad_optional_access::what() const noexcept {
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
|
||||
: public std::logic_error
|
||||
: public std::logic_error
|
||||
{
|
||||
public:
|
||||
bad_optional_access() : std::logic_error("Bad optional Access") {}
|
||||
bad_optional_access() : std::logic_error("Bad optional Access") {}
|
||||
|
||||
// Get the key function ~bad_optional_access() into the dylib
|
||||
virtual ~bad_optional_access() noexcept;
|
||||
// Get the key function ~bad_optional_access() into the dylib
|
||||
virtual ~bad_optional_access() noexcept;
|
||||
};
|
||||
|
||||
bad_optional_access::~bad_optional_access() noexcept = default;
|
||||
|
@ -19,7 +19,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 int foo() { return 6; }
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
foo(); // no error here!
|
||||
foo(); // no error here!
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Test that _LIBCPP_NODISCARD_AFTER_CXX17 works
|
||||
// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
|
||||
// #define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::basic_filebuf<char, std::char_traits<wchar_t> > f;
|
||||
// expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
std::basic_filebuf<char, std::char_traits<wchar_t> > f;
|
||||
// expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
// close();
|
||||
|
||||
// Inspired by PR#38052 - std::fstream still good after closing and updating content
|
||||
// Inspired by PR#38052 - std::fstream still good after closing and updating content
|
||||
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
@ -33,5 +33,5 @@ int main(int, char**)
|
||||
|
||||
std::remove(temp.c_str());
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::basic_fstream<char, std::char_traits<wchar_t> > f;
|
||||
std::basic_fstream<char, std::char_traits<wchar_t> > f;
|
||||
// expected-error-re@ios:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
// expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
std::basic_stringbuf<char, std::char_traits<wchar_t> > sb;
|
||||
std::basic_stringbuf<char, std::char_traits<wchar_t> > sb;
|
||||
// expected-error-re@streambuf:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
// expected-error-re@string:* {{{{(static_assert|static assertion)}} failed{{.*}}traits_type::char_type must be the same type as CharT}}
|
||||
|
||||
|
@ -24,13 +24,13 @@ int main(int, char**) {
|
||||
int a[] = {1, 2, 3};
|
||||
|
||||
bidirectional_iterator<int *> bidi(a+1);
|
||||
std::advance(bidi, 1); // should work fine
|
||||
std::advance(bidi, 0); // should work fine
|
||||
std::advance(bidi, 1); // should work fine
|
||||
std::advance(bidi, 0); // should work fine
|
||||
std::advance(bidi, -1); // should work fine
|
||||
|
||||
forward_iterator<int *> it(a+1);
|
||||
std::advance(it, 1); // should work fine
|
||||
std::advance(it, 0); // should work fine
|
||||
std::advance(it, 1); // should work fine
|
||||
std::advance(it, 0); // should work fine
|
||||
TEST_LIBCPP_ASSERT_FAILURE(std::advance(it, -1), "Attempt to advance(it, n) with negative n on a non-bidirectional iterator");
|
||||
|
||||
return 0;
|
||||
|
@ -49,6 +49,6 @@ struct no_element_type {
|
||||
|
||||
void test() {
|
||||
(void) std::contiguous_iterator<no_element_type>;
|
||||
// expected-error@*:* {{implicit instantiation of undefined template}}
|
||||
// expected-note@*:* {{to_address}}
|
||||
// expected-error@*:* {{implicit instantiation of undefined template}}
|
||||
// expected-note@*:* {{to_address}}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
// bool failed() const throw();
|
||||
//
|
||||
// Extension: constructing from NULL is UB; we just make it a failed iterator
|
||||
// Extension: constructing from NULL is UB; we just make it a failed iterator
|
||||
|
||||
#include <iterator>
|
||||
#include <cassert>
|
||||
|
@ -25,19 +25,19 @@
|
||||
template <typename T>
|
||||
void test_allocators()
|
||||
{
|
||||
static_assert(!std::__is_allocator<T>::value, "" );
|
||||
static_assert( std::__is_allocator<std::allocator<T>>::value, "" );
|
||||
static_assert( std::__is_allocator<test_allocator<T>>::value, "" );
|
||||
static_assert( std::__is_allocator<min_allocator<T>>::value, "" );
|
||||
static_assert(!std::__is_allocator<T>::value, "" );
|
||||
static_assert( std::__is_allocator<std::allocator<T>>::value, "" );
|
||||
static_assert( std::__is_allocator<test_allocator<T>>::value, "" );
|
||||
static_assert( std::__is_allocator<min_allocator<T>>::value, "" );
|
||||
}
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
// test_allocators<void>();
|
||||
test_allocators<char>();
|
||||
test_allocators<int>();
|
||||
test_allocators<std::string>();
|
||||
// test_allocators<void>();
|
||||
test_allocators<char>();
|
||||
test_allocators<int>();
|
||||
test_allocators<std::string>();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ concept HasInplaceMergeIter =
|
||||
|
||||
static_assert(HasInplaceMergeIter<int*, int*, int*>);
|
||||
|
||||
// !bidirectional_iterator<I>
|
||||
// !bidirectional_iterator<I>
|
||||
static_assert(!HasInplaceMergeIter<BidirectionalIteratorNotDerivedFrom>);
|
||||
static_assert(!HasInplaceMergeIter<cpp20_input_iterator<int*>>);
|
||||
|
||||
@ -287,7 +287,7 @@ bool test() {
|
||||
|
||||
// Complexity: Let N = last - first :
|
||||
// - For the overloads with no ExecutionPolicy, and if enough
|
||||
// additional memory is available, exactly N − 1 comparisons.
|
||||
// additional memory is available, exactly N - 1 comparisons.
|
||||
// - Otherwise, O(NlogN) comparisons.
|
||||
// In either case, twice as many projections as comparisons.
|
||||
{
|
||||
|
@ -10,13 +10,13 @@
|
||||
|
||||
// <algorithm>
|
||||
|
||||
// template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
||||
// template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
||||
// class Proj = identity>
|
||||
// requires sortable<I, Comp, Proj>
|
||||
// constexpr I
|
||||
// ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
|
||||
//
|
||||
// template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
||||
// template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
||||
// requires sortable<iterator_t<R>, Comp, Proj>
|
||||
// constexpr borrowed_iterator_t<R>
|
||||
// ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
|
||||
|
@ -321,7 +321,7 @@ constexpr bool test() {
|
||||
// Stable ([algorithm.stable]). If [first1, last1) contains m elements that are
|
||||
// equivalent to each other and [first2, last2) contains n elements that are
|
||||
// equivalent to them, then all m elements from the first range are copied to the
|
||||
// output range, in order, and then the final max(n−m,0) elements from the second
|
||||
// output range, in order, and then the final max(n-m,0) elements from the second
|
||||
// range are copied to the output range, in order.
|
||||
{
|
||||
std::array<IntAndOrder, 3> r1{{{0, 0}, {0, 1}, {0, 2}}};
|
||||
|
@ -191,8 +191,8 @@ test_pointer_sort()
|
||||
// way that they would invoke O(N^2) behavior on any quick sort implementation
|
||||
// that satisifies certain conditions. Details are available in the following
|
||||
// paper:
|
||||
// "A Killer Adversary for Quicksort", M. D. McIlroy, Software—Practice &
|
||||
// ExperienceVolume 29 Issue 4 April 10, 1999 pp 341–344.
|
||||
// "A Killer Adversary for Quicksort", M. D. McIlroy, Software-Practice &
|
||||
// Experience Volume 29 Issue 4 April 10, 1999 pp 341-344.
|
||||
// https://dl.acm.org/doi/10.5555/311868.311871.
|
||||
struct AdversaryComparator {
|
||||
AdversaryComparator(int N, std::vector<int>& input) : gas(N - 1), V(input) {
|
||||
|
@ -41,9 +41,9 @@ int main(int, char**) {
|
||||
L c(a1, a1 + 4);
|
||||
#if TEST_STD_VER > 17
|
||||
assert(c.remove(3) == 1);
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove(3)));
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove(3)));
|
||||
#else
|
||||
ASSERT_SAME_TYPE(void, decltype(c.remove(3)));
|
||||
ASSERT_SAME_TYPE(void, decltype(c.remove(3)));
|
||||
c.remove(3);
|
||||
#endif
|
||||
|
||||
|
@ -49,10 +49,10 @@ int main(int, char**)
|
||||
L c(a1, a1+4);
|
||||
Predicate cp(g);
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove_if(std::ref(cp))));
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.remove_if(std::ref(cp))));
|
||||
assert(c.remove_if(std::ref(cp)) == 2);
|
||||
#else
|
||||
ASSERT_SAME_TYPE(void, decltype(c.remove_if(std::ref(cp))));
|
||||
ASSERT_SAME_TYPE(void, decltype(c.remove_if(std::ref(cp))));
|
||||
c.remove_if(std::ref(cp));
|
||||
#endif
|
||||
assert(c == std::list<int>(a2, a2+2));
|
||||
|
@ -25,10 +25,10 @@ int main(int, char**)
|
||||
typedef std::list<int> L;
|
||||
L c(a1, a1+sizeof(a1)/sizeof(a1[0]));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique()));
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique()));
|
||||
assert(c.unique() == 5);
|
||||
#else
|
||||
ASSERT_SAME_TYPE(void, decltype(c.unique()));
|
||||
ASSERT_SAME_TYPE(void, decltype(c.unique()));
|
||||
c.unique();
|
||||
#endif
|
||||
assert(c == std::list<int>(a2, a2+4));
|
||||
|
@ -40,10 +40,10 @@ int main(int, char**)
|
||||
typedef std::list<int> L;
|
||||
L c(a1, a1+sizeof(a1)/sizeof(a1[0]));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique(g)));
|
||||
ASSERT_SAME_TYPE(L::size_type, decltype(c.unique(g)));
|
||||
assert(c.unique(g) == 5);
|
||||
#else
|
||||
ASSERT_SAME_TYPE(void, decltype(c.unique(g)));
|
||||
ASSERT_SAME_TYPE(void, decltype(c.unique(g)));
|
||||
c.unique(g);
|
||||
#endif
|
||||
assert(c == std::list<int>(a2, a2+4));
|
||||
|
@ -17,8 +17,8 @@
|
||||
// constexpr span(const array<value_type, N>& arr) noexcept;
|
||||
//
|
||||
// Remarks: These constructors shall not participate in overload resolution unless:
|
||||
// — extent == dynamic_extent || N == extent is true, and
|
||||
// — remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
// - extent == dynamic_extent || N == extent is true, and
|
||||
// - remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
//
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
// constexpr span(element_type (&arr)[N]) noexcept;
|
||||
//
|
||||
// Remarks: These constructors shall not participate in overload resolution unless:
|
||||
// — extent == dynamic_extent || N == extent is true, and
|
||||
// — remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
// - extent == dynamic_extent || N == extent is true, and
|
||||
// - remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
//
|
||||
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
// constexpr span(const array<value_type, N>& arr) noexcept;
|
||||
//
|
||||
// Remarks: These constructors shall not participate in overload resolution unless:
|
||||
// — extent == dynamic_extent || N == extent is true, and
|
||||
// — remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
// - extent == dynamic_extent || N == extent is true, and
|
||||
// - remove_pointer_t<decltype(data(arr))>(*)[] is convertible to ElementType(*)[].
|
||||
//
|
||||
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
// <experimental/type_traits>
|
||||
//
|
||||
// struct nonesuch;
|
||||
// nonesuch has no default constructor (C++17 §15.1)
|
||||
// or initializer-list constructor (C++17 §11.6.4),
|
||||
// and is not an aggregate (C++17 §11.6.1).
|
||||
// nonesuch has no default constructor (C++17 section 15.1)
|
||||
// or initializer-list constructor (C++17 section 11.6.4),
|
||||
// and is not an aggregate (C++17 section 11.6.1).
|
||||
|
||||
|
||||
#include <experimental/type_traits>
|
||||
|
@ -76,7 +76,7 @@ int main(int, char**) {
|
||||
// p3: Replace each directory-separator with a preferred-separator.
|
||||
// [ Note: The generic pathname grammar ([fs.path.generic]) defines
|
||||
// directory-separator as one or more slashes and preferred-separators.
|
||||
// — end note ]
|
||||
// - end note ]
|
||||
{"/", "/"},
|
||||
{"//", "/"},
|
||||
{"///", "/"},
|
||||
@ -108,7 +108,7 @@ int main(int, char**) {
|
||||
{"foo/bar/./../", "foo/"},
|
||||
// p6: If there is a root-directory, remove all dot-dot filenames and any
|
||||
// directory-separators immediately following them. [ Note: These dot-dot
|
||||
// filenames attempt to refer to nonexistent parent directories. — end note ]
|
||||
// filenames attempt to refer to nonexistent parent directories. - end note ]
|
||||
{"/..", "/"},
|
||||
{"/../", "/"},
|
||||
{"/foo/../..", "/"},
|
||||
|
@ -83,7 +83,7 @@ int main(int, char**)
|
||||
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
|
||||
std::string ex(str, base(iter));
|
||||
#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX)
|
||||
// These platforms have no alternative
|
||||
// These platforms have no alternative
|
||||
assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively 6.");
|
||||
#else
|
||||
assert(ex == "Today is \xE5\x9C\x9F\xE6\x9B\x9C\xE6\x97\xA5 which is the 6th day or alternatively \xE5\x85\xAD.");
|
||||
|
@ -12,7 +12,7 @@
|
||||
// constexpr T bit_ceil(T x) noexcept;
|
||||
|
||||
// Remarks: This function shall not participate in overload resolution unless
|
||||
// T is an unsigned integer type
|
||||
// T is an unsigned integer type
|
||||
|
||||
#include <bit>
|
||||
#include <cstdint>
|
||||
@ -28,25 +28,25 @@ enum class E2 : unsigned char { red };
|
||||
template <typename T>
|
||||
constexpr bool toobig()
|
||||
{
|
||||
return 0 == std::bit_ceil(std::numeric_limits<T>::max());
|
||||
return 0 == std::bit_ceil(std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
// Make sure we generate a compile-time error for UB
|
||||
static_assert(toobig<unsigned char>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned short>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned long>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned long long>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
// Make sure we generate a compile-time error for UB
|
||||
static_assert(toobig<unsigned char>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned short>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned long>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<unsigned long long>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
|
||||
static_assert(toobig<uint8_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint16_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint32_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint64_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<size_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uintmax_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uintptr_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint8_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint16_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint32_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uint64_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<size_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uintmax_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
static_assert(toobig<uintptr_t>(), ""); // expected-error-re {{{{(static_assert|static assertion)}} expression is not an integral constant expression}}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ test_use_move()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
void
|
||||
#else
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
@ -114,8 +114,8 @@ test()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
#endif
|
||||
test_string();
|
||||
|
||||
|
@ -70,7 +70,7 @@ test_use_move()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
void
|
||||
#else
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
@ -183,8 +183,8 @@ test()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
#endif
|
||||
test_string();
|
||||
|
||||
|
@ -77,7 +77,7 @@ test_use_move()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
void
|
||||
#else
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
@ -154,8 +154,8 @@ test()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
#endif
|
||||
test_string();
|
||||
|
||||
|
@ -95,31 +95,31 @@ void fp_test()
|
||||
|
||||
#if defined(__PPC__) && (defined(__LONG_DOUBLE_128__) && __LONG_DOUBLE_128__) && \
|
||||
!(defined(__LONG_DOUBLE_IEEE128__) && __LONG_DOUBLE_IEEE128__)
|
||||
// For 128 bit long double implemented as 2 doubles on PowerPC,
|
||||
// nextafterl() of libm gives imprecise results which fails the
|
||||
// midpoint() tests below. So skip the test for this case.
|
||||
// For 128 bit long double implemented as 2 doubles on PowerPC,
|
||||
// nextafterl() of libm gives imprecise results which fails the
|
||||
// midpoint() tests below. So skip the test for this case.
|
||||
if constexpr (sizeof(T) != 16)
|
||||
#endif
|
||||
{
|
||||
// Since there's nothing in between, the midpoint has to be one or the other
|
||||
T res;
|
||||
res = std::midpoint(d0, d1);
|
||||
assert(res == d0 || res == d1);
|
||||
assert(d0 <= res);
|
||||
assert(res <= d1);
|
||||
res = std::midpoint(d1, d0);
|
||||
assert(res == d0 || res == d1);
|
||||
assert(d0 <= res);
|
||||
assert(res <= d1);
|
||||
// Since there's nothing in between, the midpoint has to be one or the other
|
||||
T res;
|
||||
res = std::midpoint(d0, d1);
|
||||
assert(res == d0 || res == d1);
|
||||
assert(d0 <= res);
|
||||
assert(res <= d1);
|
||||
res = std::midpoint(d1, d0);
|
||||
assert(res == d0 || res == d1);
|
||||
assert(d0 <= res);
|
||||
assert(res <= d1);
|
||||
|
||||
res = std::midpoint(d1, d2);
|
||||
assert(res == d1 || res == d2);
|
||||
assert(d1 <= res);
|
||||
assert(res <= d2);
|
||||
res = std::midpoint(d2, d1);
|
||||
assert(res == d1 || res == d2);
|
||||
assert(d1 <= res);
|
||||
assert(res <= d2);
|
||||
res = std::midpoint(d1, d2);
|
||||
assert(res == d1 || res == d2);
|
||||
assert(d1 <= res);
|
||||
assert(res <= d2);
|
||||
res = std::midpoint(d2, d1);
|
||||
assert(res == d1 || res == d2);
|
||||
assert(d1 <= res);
|
||||
assert(res <= d2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ test_use_move()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
void
|
||||
#else
|
||||
TEST_CONSTEXPR_CXX20 void
|
||||
@ -137,8 +137,8 @@ test()
|
||||
// don't have the support yet. In these cases omit the constexpr test.
|
||||
// FIXME Remove constexpr string workaround introduced in D90569
|
||||
#if TEST_STD_VER > 17 && \
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
(!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
|
||||
if (!std::is_constant_evaluated())
|
||||
#endif
|
||||
test_string();
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// constexpr auto begin();
|
||||
// constexpr auto begin() const
|
||||
// requires input_range<const V> &&
|
||||
// requires input_range<const V> &&
|
||||
// is_reference_v<range_reference_t<const V>>;
|
||||
|
||||
#include <cassert>
|
||||
@ -119,7 +119,7 @@ constexpr bool test() {
|
||||
static_assert(HasConstBegin<decltype(jv)>);
|
||||
}
|
||||
|
||||
// !input_range<const V>
|
||||
// !input_range<const V>
|
||||
{
|
||||
std::ranges::join_view jv{ConstNotRange{}};
|
||||
static_assert(!HasConstBegin<decltype(jv)>);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
// constexpr iterator(iterator<!Const> i)
|
||||
// requires Const &&
|
||||
// convertible_to<iterator_t<V>, OuterIter> &&
|
||||
// convertible_to<iterator_t<InnerRng>, InnerIter>;
|
||||
// convertible_to<iterator_t<V>, OuterIter> &&
|
||||
// convertible_to<iterator_t<InnerRng>, InnerIter>;
|
||||
|
||||
#include <cassert>
|
||||
#include <ranges>
|
||||
|
@ -9,13 +9,13 @@
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||
|
||||
// constexpr iterator& operator--();
|
||||
// requires ref-is-glvalue && bidirectional_range<Base> &&
|
||||
// bidirectional_range<range_reference_t<Base>> &&
|
||||
// common_range<range_reference_t<Base>>;
|
||||
// requires ref-is-glvalue && bidirectional_range<Base> &&
|
||||
// bidirectional_range<range_reference_t<Base>> &&
|
||||
// common_range<range_reference_t<Base>>;
|
||||
// constexpr iterator operator--(int);
|
||||
// requires ref-is-glvalue && bidirectional_range<Base> &&
|
||||
// bidirectional_range<range_reference_t<Base>> &&
|
||||
// common_range<range_reference_t<Base>>;
|
||||
// requires ref-is-glvalue && bidirectional_range<Base> &&
|
||||
// bidirectional_range<range_reference_t<Base>> &&
|
||||
// common_range<range_reference_t<Base>>;
|
||||
|
||||
#include <cassert>
|
||||
#include <ranges>
|
||||
@ -124,7 +124,7 @@ constexpr bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
// !bidirectional_range<Base>
|
||||
// !bidirectional_range<Base>
|
||||
BidiCommonInner inners[2] = {buffer[0], buffer[1]};
|
||||
SimpleForwardCommonOuter<BidiCommonInner> outer{inners};
|
||||
std::ranges::join_view jv(outer);
|
||||
@ -132,7 +132,7 @@ constexpr bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
// !bidirectional_range<range_reference_t<Base>>
|
||||
// !bidirectional_range<range_reference_t<Base>>
|
||||
ForwardCommonInner inners[2] = {buffer[0], buffer[1]};
|
||||
std::ranges::join_view jv(inners);
|
||||
noDecrementTest(jv);
|
||||
@ -141,7 +141,7 @@ constexpr bool test() {
|
||||
{
|
||||
// LWG3313 `join_view::iterator::operator--` is incorrectly constrained
|
||||
// `join_view::iterator` should not have `operator--` if
|
||||
// !common_range<range_reference_t<Base>>
|
||||
// !common_range<range_reference_t<Base>>
|
||||
BidiNonCommonInner inners[2] = {buffer[0], buffer[1]};
|
||||
std::ranges::join_view jv(inners);
|
||||
auto iter = jv.begin();
|
||||
|
@ -11,7 +11,7 @@
|
||||
// constexpr iterator& operator++();
|
||||
// constexpr void operator++(int);
|
||||
// constexpr iterator operator++(int)
|
||||
// requires ref-is-glvalue && forward_range<Base> &&
|
||||
// requires ref-is-glvalue && forward_range<Base> &&
|
||||
// forward_range<range_reference_t<Base>>;
|
||||
|
||||
#include <cassert>
|
||||
@ -186,7 +186,7 @@ constexpr bool test() {
|
||||
}
|
||||
|
||||
{
|
||||
// !forward_range<Base>
|
||||
// !forward_range<Base>
|
||||
BufferView<int*> inners[2] = {buffer1[0], buffer1[1]};
|
||||
using Outer = SimpleInputCommonOuter<BufferView<int*>>;
|
||||
std::ranges::join_view jv{Outer(inners)};
|
||||
|
@ -9,7 +9,7 @@
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17
|
||||
|
||||
// constexpr sentinel(sentinel<!Const> s);
|
||||
// requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
|
||||
// requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
|
||||
|
||||
#include <cassert>
|
||||
#include <ranges>
|
||||
|
@ -16,7 +16,7 @@
|
||||
// x - y;
|
||||
// All the arithmetic operators have the constraint `requires all-random-access<Const, Views...>;`,
|
||||
// except `operator-(x, y)` which instead has the constraint
|
||||
// `requires (sized_sentinel_for<iterator_t<maybe-const<Const, Views>>,
|
||||
// `requires (sized_sentinel_for<iterator_t<maybe-const<Const, Views>>,
|
||||
// iterator_t<maybe-const<Const, Views>>> && ...);`
|
||||
|
||||
#include <ranges>
|
||||
|
@ -9,7 +9,7 @@
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
||||
// friend constexpr bool operator==(const iterator& x, const iterator& y)
|
||||
// requires (equality_comparable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
// requires (equality_comparable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
// friend constexpr bool operator<(const iterator& x, const iterator& y)
|
||||
// requires all-random-access<Const, Views...>;
|
||||
// friend constexpr bool operator>(const iterator& x, const iterator& y)
|
||||
@ -20,7 +20,7 @@
|
||||
// requires all-random-access<Const, Views...>;
|
||||
// friend constexpr auto operator<=>(const iterator& x, const iterator& y)
|
||||
// requires all-random-access<Const, Views...> &&
|
||||
// (three_way_comparable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
// (three_way_comparable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
|
||||
#include <ranges>
|
||||
#include <compare>
|
||||
|
@ -9,7 +9,7 @@
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
||||
// constexpr iterator(iterator<!Const> i)
|
||||
// requires Const && (convertible_to<iterator_t<Views>,
|
||||
// requires Const && (convertible_to<iterator_t<Views>,
|
||||
// iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
|
||||
#include <ranges>
|
||||
|
@ -9,7 +9,7 @@
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
||||
// friend constexpr void iter_swap(const iterator& l, const iterator& r) noexcept(see below)
|
||||
// requires (indirectly_swappable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
// requires (indirectly_swappable<iterator_t<maybe-const<Const, Views>>> && ...);
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
|
@ -12,7 +12,7 @@
|
||||
// requires(sized_sentinel_for<sentinel_t<maybe-const<Const, Views>>,
|
||||
// iterator_t<maybe-const<OtherConst, Views>>>&&...)
|
||||
// friend constexpr common_type_t<range_difference_t<maybe-const<OtherConst, Views>>...>
|
||||
// operator-(const iterator<OtherConst>&, const sentinel&)
|
||||
// operator-(const iterator<OtherConst>&, const sentinel&)
|
||||
//
|
||||
// template <bool OtherConst>
|
||||
// requires(sized_sentinel_for<sentinel_t<maybe-const<Const, Views>>,
|
||||
|
@ -9,10 +9,10 @@
|
||||
// <regex>
|
||||
// UNSUPPORTED: c++03, c++11, c++14
|
||||
|
||||
// template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
||||
// vector(InputIterator, InputIterator, Allocator = Allocator())
|
||||
// -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>;
|
||||
//
|
||||
// template<class ForwardIterator>
|
||||
// basic_regex(ForwardIterator, ForwardIterator,
|
||||
// regex_constants::syntax_option_type = regex_constants::ECMAScript)
|
||||
// -> basic_regex<typename iterator_traits<ForwardIterator>::value_type>;
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
@ -23,21 +23,18 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
// Test the explicit deduction guides
|
||||
// Test the explicit deduction guides
|
||||
{
|
||||
// basic_regex(ForwardIterator, ForwardIterator)
|
||||
// <int> is not an iterator
|
||||
// basic_regex(ForwardIterator, ForwardIterator)
|
||||
// <int> is not an iterator
|
||||
std::basic_regex re(23, 34); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_regex'}}
|
||||
}
|
||||
|
||||
{
|
||||
// basic_regex(ForwardIterator, ForwardIterator, flag_type)
|
||||
// <double> is not an iterator
|
||||
// basic_regex(ForwardIterator, ForwardIterator, flag_type)
|
||||
// <double> is not an iterator
|
||||
std::basic_regex re(23.0, 34.0, std::regex_constants::basic); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'basic_regex'}}
|
||||
}
|
||||
|
||||
// Test the implicit deduction guides
|
||||
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
|
||||
// [months{0}, months{11}] satisfying y + m == x.
|
||||
// Otherwise the value returned is unspecified.
|
||||
// [Example: January - February == months{11}. —end example]
|
||||
// [Example: January - February == months{11}. -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -20,8 +20,8 @@
|
||||
// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity
|
||||
// and always produces a remainder in the range of [0, 11].
|
||||
// Assuming no overflow in the signed summation, this operation results in a month
|
||||
// holding a value in the range [1, 12] even if !x.ok(). —end note]
|
||||
// [Example: February + months{11} == January. —end example]
|
||||
// holding a value in the range [1, 12] even if !x.ok(). -end note]
|
||||
// [Example: February + months{11} == January. -end example]
|
||||
|
||||
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
// operator/(const day& d, int m) noexcept;
|
||||
// Returns: month(m) / d.
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//
|
||||
// [Note: A month_day_last object can be constructed using the expression m/last or last/m,
|
||||
// where m is an expression of type month. — end note]
|
||||
// where m is an expression of type month. - end note]
|
||||
// [Example:
|
||||
// constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified year
|
||||
// static_assert(mdl.month() == February);
|
||||
|
@ -26,16 +26,12 @@
|
||||
// operator/(const weekday_indexed& wdi, int m) noexcept;
|
||||
// Returns: month(m) / wdi.
|
||||
|
||||
|
||||
//
|
||||
// [Example:
|
||||
// constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified year
|
||||
// static_assert(mwd.month() == February);
|
||||
// static_assert(mwd.weekday_indexed() == Tuesday[3]);
|
||||
// —end example]
|
||||
|
||||
|
||||
|
||||
// -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -26,9 +26,6 @@
|
||||
// operator/(const weekday_last& wdl, int m) noexcept;
|
||||
// Returns: month(m) / wdl.
|
||||
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -16,8 +16,6 @@
|
||||
// constexpr year_month operator/(const year& y, int m) noexcept;
|
||||
// Returns: y / month(m).
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -34,7 +34,6 @@
|
||||
// operator/(const month_day& md, int y) noexcept;
|
||||
// Returns: year(y) / md.
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -30,7 +30,6 @@
|
||||
// operator/(const month_day_last& mdl, int y) noexcept;
|
||||
// Returns: year(y) / mdl.
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -30,8 +30,6 @@
|
||||
// operator/(const month_weekday_last& mwdl, int y) noexcept;
|
||||
// Returns: year(y) / mwdl.
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
#include <cassert>
|
||||
|
@ -21,7 +21,7 @@
|
||||
//
|
||||
// [Example:
|
||||
// If dp represents 1970-01-01, the constructed weekday represents Thursday by storing 4 in wd_.
|
||||
// —end example]
|
||||
// -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -21,7 +21,7 @@
|
||||
//
|
||||
// [Example:
|
||||
// If dp represents 1970-01-01, the constructed weekday represents Thursday by storing 4 in wd_.
|
||||
// —end example]
|
||||
// -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -17,7 +17,7 @@
|
||||
// Returns: If x.ok() == true and y.ok() == true, returns a value d in the range
|
||||
// [days{0}, days{6}] satisfying y + d == x.
|
||||
// Otherwise the value returned is unspecified.
|
||||
// [Example: Sunday - Monday == days{6}. —end example]
|
||||
// [Example: Sunday - Monday == days{6}. -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -20,10 +20,8 @@
|
||||
// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity
|
||||
// and always produces a remainder in the range of [0, 6].
|
||||
// Assuming no overflow in the signed summation, this operation results in a weekday
|
||||
// holding a value in the range [0, 6] even if !x.ok(). —end note]
|
||||
// [Example: Monday + days{6} == Sunday. —end example]
|
||||
|
||||
|
||||
// holding a value in the range [0, 6] even if !x.ok(). -end note]
|
||||
// [Example: Monday + days{6} == Sunday. -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -17,7 +17,7 @@
|
||||
// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
|
||||
// [years{0}, years{11}] satisfying y + m == x.
|
||||
// Otherwise the value returned is unspecified.
|
||||
// [Example: January - February == years{11}. —end example]
|
||||
// [Example: January - February == years{11}. -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -27,7 +27,7 @@
|
||||
// static_assert(year_month_day{local_days{2017y/January/0}} == 2016y/December/31);
|
||||
// static_assert(year_month_day{local_days{2017y/January/31}} == 2017y/January/31);
|
||||
// static_assert(year_month_day{local_days{2017y/January/32}} == 2017y/February/1);
|
||||
// —end example]
|
||||
// -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -27,7 +27,7 @@
|
||||
// static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);
|
||||
// static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);
|
||||
// static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1);
|
||||
// —end example]
|
||||
// -end example]
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
// [Example:
|
||||
// sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s.
|
||||
// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946’684’800s, which is 10’957 * 86’400s.
|
||||
// —end example]
|
||||
// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946'684'800s, which is 10'957 * 86'400s.
|
||||
// - end example]
|
||||
|
||||
|
||||
#include <chrono>
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
// [Example:
|
||||
// sys_seconds{sys_days{1970y/January/1}}.time_since_epoch() is 0s.
|
||||
// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946’684’800s, which is 10’957 * 86’400s.
|
||||
// —end example]
|
||||
// sys_seconds{sys_days{2000y/January/1}}.time_since_epoch() is 946'684'800s, which is 10'957 * 86'400s.
|
||||
// - end example]
|
||||
|
||||
|
||||
#include <chrono>
|
||||
|
@ -19,19 +19,19 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
using hours = std::chrono::hours;
|
||||
ASSERT_SAME_TYPE(bool, decltype(std::chrono::is_am(std::declval<hours>())));
|
||||
ASSERT_NOEXCEPT( std::chrono::is_am(std::declval<hours>()));
|
||||
using hours = std::chrono::hours;
|
||||
ASSERT_SAME_TYPE(bool, decltype(std::chrono::is_am(std::declval<hours>())));
|
||||
ASSERT_NOEXCEPT( std::chrono::is_am(std::declval<hours>()));
|
||||
|
||||
static_assert( std::chrono::is_am(hours( 0)), "");
|
||||
static_assert( std::chrono::is_am(hours(11)), "");
|
||||
static_assert(!std::chrono::is_am(hours(12)), "");
|
||||
static_assert(!std::chrono::is_am(hours(23)), "");
|
||||
static_assert( std::chrono::is_am(hours( 0)), "");
|
||||
static_assert( std::chrono::is_am(hours(11)), "");
|
||||
static_assert(!std::chrono::is_am(hours(12)), "");
|
||||
static_assert(!std::chrono::is_am(hours(23)), "");
|
||||
|
||||
for (int i = 0; i < 12; ++i)
|
||||
assert( std::chrono::is_am(hours(i)));
|
||||
for (int i = 12; i < 24; ++i)
|
||||
assert(!std::chrono::is_am(hours(i)));
|
||||
for (int i = 0; i < 12; ++i)
|
||||
assert( std::chrono::is_am(hours(i)));
|
||||
for (int i = 12; i < 24; ++i)
|
||||
assert(!std::chrono::is_am(hours(i)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,34 +23,34 @@
|
||||
template <typename Duration>
|
||||
constexpr bool check_neg(Duration d)
|
||||
{
|
||||
ASSERT_SAME_TYPE(bool, decltype(std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative()));
|
||||
ASSERT_NOEXCEPT( std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative());
|
||||
return std::chrono::hh_mm_ss<Duration>(d).is_negative();
|
||||
ASSERT_SAME_TYPE(bool, decltype(std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative()));
|
||||
ASSERT_NOEXCEPT( std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative());
|
||||
return std::chrono::hh_mm_ss<Duration>(d).is_negative();
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
|
||||
static_assert(!check_neg(std::chrono::minutes( 1)), "");
|
||||
static_assert( check_neg(std::chrono::minutes(-1)), "");
|
||||
static_assert(!check_neg(std::chrono::minutes( 1)), "");
|
||||
static_assert( check_neg(std::chrono::minutes(-1)), "");
|
||||
|
||||
assert(!check_neg(std::chrono::seconds( 5000)));
|
||||
assert( check_neg(std::chrono::seconds(-5000)));
|
||||
assert(!check_neg(std::chrono::minutes( 5000)));
|
||||
assert( check_neg(std::chrono::minutes(-5000)));
|
||||
assert(!check_neg(std::chrono::hours( 11)));
|
||||
assert( check_neg(std::chrono::hours(-11)));
|
||||
assert(!check_neg(std::chrono::seconds( 5000)));
|
||||
assert( check_neg(std::chrono::seconds(-5000)));
|
||||
assert(!check_neg(std::chrono::minutes( 5000)));
|
||||
assert( check_neg(std::chrono::minutes(-5000)));
|
||||
assert(!check_neg(std::chrono::hours( 11)));
|
||||
assert( check_neg(std::chrono::hours(-11)));
|
||||
|
||||
assert(!check_neg(std::chrono::milliseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::milliseconds(-123456789LL)));
|
||||
assert(!check_neg(std::chrono::microseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::microseconds(-123456789LL)));
|
||||
assert(!check_neg(std::chrono::nanoseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::nanoseconds(-123456789LL)));
|
||||
assert(!check_neg(std::chrono::milliseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::milliseconds(-123456789LL)));
|
||||
assert(!check_neg(std::chrono::microseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::microseconds(-123456789LL)));
|
||||
assert(!check_neg(std::chrono::nanoseconds( 123456789LL)));
|
||||
assert( check_neg(std::chrono::nanoseconds(-123456789LL)));
|
||||
|
||||
assert(!check_neg(microfortnights( 10000)));
|
||||
assert( check_neg(microfortnights(-10000)));
|
||||
assert(!check_neg(microfortnights( 10000)));
|
||||
assert( check_neg(microfortnights(-10000)));
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,57 +26,57 @@
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr unsigned long long powers[] = {
|
||||
1ULL,
|
||||
10ULL,
|
||||
100ULL,
|
||||
1000ULL,
|
||||
10000ULL,
|
||||
100000ULL,
|
||||
1000000ULL,
|
||||
10000000ULL,
|
||||
100000000ULL,
|
||||
1000000000ULL,
|
||||
10000000000ULL,
|
||||
100000000000ULL,
|
||||
1000000000000ULL,
|
||||
10000000000000ULL,
|
||||
100000000000000ULL,
|
||||
1000000000000000ULL,
|
||||
10000000000000000ULL,
|
||||
100000000000000000ULL,
|
||||
1000000000000000000ULL,
|
||||
10000000000000000000ULL
|
||||
1ULL,
|
||||
10ULL,
|
||||
100ULL,
|
||||
1000ULL,
|
||||
10000ULL,
|
||||
100000ULL,
|
||||
1000000ULL,
|
||||
10000000ULL,
|
||||
100000000ULL,
|
||||
1000000000ULL,
|
||||
10000000000ULL,
|
||||
100000000000ULL,
|
||||
1000000000000ULL,
|
||||
10000000000000ULL,
|
||||
100000000000000ULL,
|
||||
1000000000000000ULL,
|
||||
10000000000000000ULL,
|
||||
100000000000000000ULL,
|
||||
1000000000000000000ULL,
|
||||
10000000000000000000ULL
|
||||
};
|
||||
|
||||
template <typename Duration, unsigned width>
|
||||
constexpr bool check_precision()
|
||||
{
|
||||
using HMS = std::chrono::hh_mm_ss<Duration>;
|
||||
using CT = std::common_type_t<typename Duration::rep, std::chrono::seconds::rep>;
|
||||
using Pre = std::chrono::duration<CT, std::ratio<1, powers[width]>>;
|
||||
return std::is_same_v<typename HMS::precision, Pre>;
|
||||
using HMS = std::chrono::hh_mm_ss<Duration>;
|
||||
using CT = std::common_type_t<typename Duration::rep, std::chrono::seconds::rep>;
|
||||
using Pre = std::chrono::duration<CT, std::ratio<1, powers[width]>>;
|
||||
return std::is_same_v<typename HMS::precision, Pre>;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
|
||||
static_assert( check_precision<std::chrono::hours, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::minutes, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::seconds, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::milliseconds, 3>(), "");
|
||||
static_assert( check_precision<std::chrono::microseconds, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::nanoseconds, 9>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 2>>, 1>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 3>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 4>>, 2>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 5>>, 1>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 6>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 7>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 8>>, 3>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 9>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 10>>, 1>(), "");
|
||||
static_assert( check_precision<microfortnights, 4>(), "");
|
||||
static_assert( check_precision<std::chrono::hours, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::minutes, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::seconds, 0>(), "");
|
||||
static_assert( check_precision<std::chrono::milliseconds, 3>(), "");
|
||||
static_assert( check_precision<std::chrono::microseconds, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::nanoseconds, 9>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 2>>, 1>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 3>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 4>>, 2>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 5>>, 1>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 6>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 7>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 8>>, 3>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 9>>, 6>(), "");
|
||||
static_assert( check_precision<std::chrono::duration<int, std::ratio< 1, 10>>, 1>(), "");
|
||||
static_assert( check_precision<microfortnights, 4>(), "");
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
// static unsigned constexpr fractional_width = see below;
|
||||
// using precision = see below;
|
||||
//
|
||||
// fractional_width is the number of fractional decimal digits represented by precision.
|
||||
// fractional_width is the number of fractional decimal digits represented by precision.
|
||||
// fractional_width has the value of the smallest possible integer in the range [0, 18]
|
||||
// such that precision will exactly represent all values of Duration.
|
||||
// If no such value of fractional_width exists, then fractional_width is 6.
|
||||
@ -30,30 +30,30 @@
|
||||
template <typename Duration, unsigned width>
|
||||
constexpr bool check_width()
|
||||
{
|
||||
using HMS = std::chrono::hh_mm_ss<Duration>;
|
||||
return HMS::fractional_width == width;
|
||||
using HMS = std::chrono::hh_mm_ss<Duration>;
|
||||
return HMS::fractional_width == width;
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
|
||||
|
||||
static_assert( check_width<std::chrono::hours, 0>(), "");
|
||||
static_assert( check_width<std::chrono::minutes, 0>(), "");
|
||||
static_assert( check_width<std::chrono::seconds, 0>(), "");
|
||||
static_assert( check_width<std::chrono::milliseconds, 3>(), "");
|
||||
static_assert( check_width<std::chrono::microseconds, 6>(), "");
|
||||
static_assert( check_width<std::chrono::nanoseconds, 9>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 2>>, 1>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 3>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 4>>, 2>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 5>>, 1>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 6>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 7>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 8>>, 3>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 9>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 10>>, 1>(), "");
|
||||
static_assert( check_width<microfortnights, 4>(), "");
|
||||
static_assert( check_width<std::chrono::hours, 0>(), "");
|
||||
static_assert( check_width<std::chrono::minutes, 0>(), "");
|
||||
static_assert( check_width<std::chrono::seconds, 0>(), "");
|
||||
static_assert( check_width<std::chrono::milliseconds, 3>(), "");
|
||||
static_assert( check_width<std::chrono::microseconds, 6>(), "");
|
||||
static_assert( check_width<std::chrono::nanoseconds, 9>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 2>>, 1>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 3>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 4>>, 2>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 5>>, 1>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 6>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 7>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 8>>, 3>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 9>>, 6>(), "");
|
||||
static_assert( check_width<std::chrono::duration<int, std::ratio< 1, 10>>, 1>(), "");
|
||||
static_assert( check_width<microfortnights, 4>(), "");
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ struct tiny {
|
||||
|
||||
void P2418()
|
||||
{
|
||||
auto t = tiny{};
|
||||
std::format("{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}}
|
||||
auto t = tiny{};
|
||||
std::format("{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}}
|
||||
|
||||
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
|
||||
std::format(L"{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}}
|
||||
std::format(L"{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}}
|
||||
#endif
|
||||
}
|
||||
|
@ -116,9 +116,9 @@ int main(int, char**)
|
||||
assert(globalMemCounter.checkOutstandingNewEq(1));
|
||||
RTTI_ASSERT(f.target<A>());
|
||||
RTTI_ASSERT(f.target<int(*)(int)>() == 0);
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2 = std::move(f);
|
||||
assert(A::count == 1);
|
||||
@ -140,9 +140,9 @@ int main(int, char**)
|
||||
assert(A::count == 1);
|
||||
RTTI_ASSERT(f.target<A>() == nullptr);
|
||||
RTTI_ASSERT(f.target<Ref>());
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2(std::move(f));
|
||||
assert(A::count == 1);
|
||||
@ -161,9 +161,9 @@ int main(int, char**)
|
||||
std::function<int(int)> f(p);
|
||||
RTTI_ASSERT(f.target<A>() == nullptr);
|
||||
RTTI_ASSERT(f.target<Ptr>());
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
LIBCPP_ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#if TEST_STD_VER > 17
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
ASSERT_NOEXCEPT(std::function<int(int)>(std::move(f)));
|
||||
#endif
|
||||
std::function<int(int)> f2(std::move(f));
|
||||
RTTI_ASSERT(f2.target<A>() == nullptr);
|
||||
|
@ -19,8 +19,8 @@
|
||||
template <class T, bool B>
|
||||
void test_array_imp()
|
||||
{
|
||||
static_assert( B == std::is_bounded_array<T>::value, "" );
|
||||
static_assert( B == std::is_bounded_array_v<T>, "" );
|
||||
static_assert( B == std::is_bounded_array<T>::value, "" );
|
||||
static_assert( B == std::is_bounded_array_v<T>, "" );
|
||||
}
|
||||
|
||||
template <class T, bool B>
|
||||
@ -47,21 +47,21 @@ typedef void (*FunctionPtr)();
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
// Non-array types
|
||||
test_array<void, false>();
|
||||
test_array<std::nullptr_t, false>();
|
||||
test_array<int, false>();
|
||||
test_array<double, false>();
|
||||
test_array<void *, false>();
|
||||
test_array<int &, false>();
|
||||
test_array<int &&, false>();
|
||||
// Non-array types
|
||||
test_array<void, false>();
|
||||
test_array<std::nullptr_t, false>();
|
||||
test_array<int, false>();
|
||||
test_array<double, false>();
|
||||
test_array<void *, false>();
|
||||
test_array<int &, false>();
|
||||
test_array<int &&, false>();
|
||||
test_array<Empty, false>();
|
||||
test_array<Union, false>();
|
||||
test_array<Abstract, false>();
|
||||
test_array<Enum, false>();
|
||||
test_array<FunctionPtr, false>();
|
||||
|
||||
// Array types
|
||||
// Array types
|
||||
test_array<char[3], true>();
|
||||
test_array<int[0], false>();
|
||||
test_array<char[], false>();
|
||||
|
@ -23,25 +23,25 @@ struct NonDestructible { ~NonDestructible() = delete; };
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
{
|
||||
std::optional<char &> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with a reference type is ill-formed}}
|
||||
std::optional<NonDestructible> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with a non-destructible type is ill-formed}}
|
||||
std::optional<char[20]> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with an array type is ill-formed}}
|
||||
}
|
||||
{
|
||||
std::optional<char &> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with a reference type is ill-formed}}
|
||||
std::optional<NonDestructible> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with a non-destructible type is ill-formed}}
|
||||
std::optional<char[20]> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with an array type is ill-formed}}
|
||||
}
|
||||
|
||||
{
|
||||
std::optional< std::in_place_t> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional<const std::in_place_t> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional< volatile std::in_place_t> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional<const volatile std::in_place_t> o4; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
}
|
||||
{
|
||||
std::optional< std::in_place_t> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional<const std::in_place_t> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional< volatile std::in_place_t> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
std::optional<const volatile std::in_place_t> o4; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with in_place_t is ill-formed}}
|
||||
}
|
||||
|
||||
{
|
||||
std::optional< std::nullopt_t> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional<const std::nullopt_t> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional< volatile std::nullopt_t> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional<const volatile std::nullopt_t> o4; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
}
|
||||
{
|
||||
std::optional< std::nullopt_t> o1; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional<const std::nullopt_t> o2; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional< volatile std::nullopt_t> o3; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
std::optional<const volatile std::nullopt_t> o4; // expected-error-re@optional:* {{{{(static_assert|static assertion)}} failed{{.*}}instantiation of optional with nullopt_t is ill-formed}}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
// template <class T, class D>
|
||||
// bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
|
||||
// template<class T, class D>
|
||||
// requires three_way_comparable<typename unique_ptr<T, D>::pointer>
|
||||
// requires three_way_comparable<typename unique_ptr<T, D>::pointer>
|
||||
// constexpr compare_three_way_result_t<typename unique_ptr<T, D>::pointer>
|
||||
// operator<=>(const unique_ptr<T, D>& x, nullptr_t); // C++20
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
// sizeof...(Types) equals sizeof...(UTypes) &&
|
||||
// (is_constructible_v<Types, decltype(get<I>(FWD(u)))> && ...) is true &&
|
||||
// (
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// )
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
@ -18,12 +18,12 @@
|
||||
// sizeof...(Types) equals sizeof...(UTypes) &&
|
||||
// (is_constructible_v<Types, decltype(get<I>(FWD(u)))> && ...) is true &&
|
||||
// (
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// )
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
@ -11,8 +11,7 @@
|
||||
// template <class... Types>
|
||||
// template <class Alloc, class U1, class U2>
|
||||
// constexpr explicit(see below)
|
||||
// tuple<Types...>::tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&
|
||||
// u);
|
||||
// tuple<Types...>::tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>& u);
|
||||
|
||||
// Constraints:
|
||||
// - sizeof...(Types) is 2 and
|
||||
|
@ -17,12 +17,12 @@
|
||||
// sizeof...(Types) equals sizeof...(UTypes) &&
|
||||
// (is_constructible_v<Types, decltype(get<I>(FWD(u)))> && ...) is true &&
|
||||
// (
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// )
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
@ -16,12 +16,12 @@
|
||||
// sizeof...(Types) equals sizeof...(UTypes) &&
|
||||
// (is_constructible_v<Types, decltype(get<I>(FWD(u)))> && ...) is true &&
|
||||
// (
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// sizeof...(Types) is not 1 ||
|
||||
// (
|
||||
// !is_convertible_v<decltype(u), T> &&
|
||||
// !is_constructible_v<T, decltype(u)> &&
|
||||
// !is_same_v<T, U>
|
||||
// )
|
||||
// )
|
||||
|
||||
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
|
||||
|
@ -328,20 +328,20 @@ private:
|
||||
/// This class generates the following tree:
|
||||
///
|
||||
/// static_test_env
|
||||
/// ├── bad_symlink -> dne
|
||||
/// ├── dir1
|
||||
/// │ ├── dir2
|
||||
/// │ │ ├── afile3
|
||||
/// │ │ ├── dir3
|
||||
/// │ │ │ └── file5
|
||||
/// │ │ ├── file4
|
||||
/// │ │ └── symlink_to_dir3 -> dir3
|
||||
/// │ ├── file1
|
||||
/// │ └── file2
|
||||
/// ├── empty_file
|
||||
/// ├── non_empty_file
|
||||
/// ├── symlink_to_dir -> dir1
|
||||
/// └── symlink_to_empty_file -> empty_file
|
||||
/// |-- bad_symlink -> dne
|
||||
/// |-- dir1
|
||||
/// | |-- dir2
|
||||
/// | | |-- afile3
|
||||
/// | | |-- dir3
|
||||
/// | | | `-- file5
|
||||
/// | | |-- file4
|
||||
/// | | `-- symlink_to_dir3 -> dir3
|
||||
/// | `-- file1
|
||||
/// | `-- file2
|
||||
/// |-- empty_file
|
||||
/// |-- non_empty_file
|
||||
/// |-- symlink_to_dir -> dir1
|
||||
/// `-- symlink_to_empty_file -> empty_file
|
||||
///
|
||||
class static_test_env {
|
||||
scoped_test_env env_;
|
||||
|
@ -17,29 +17,29 @@
|
||||
template<typename T>
|
||||
bool fptest_close(T val, T expected, T eps)
|
||||
{
|
||||
constexpr T zero = T(0);
|
||||
assert(eps >= zero);
|
||||
constexpr T zero = T(0);
|
||||
assert(eps >= zero);
|
||||
|
||||
// Handle the zero cases
|
||||
if (eps == zero) return val == expected;
|
||||
if (val == zero) return std::abs(expected) <= eps;
|
||||
if (expected == zero) return std::abs(val) <= eps;
|
||||
// Handle the zero cases
|
||||
if (eps == zero) return val == expected;
|
||||
if (val == zero) return std::abs(expected) <= eps;
|
||||
if (expected == zero) return std::abs(val) <= eps;
|
||||
|
||||
return std::abs(val - expected) < eps
|
||||
&& std::abs(val - expected)/std::abs(val) < eps;
|
||||
return std::abs(val - expected) < eps
|
||||
&& std::abs(val - expected)/std::abs(val) < eps;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool fptest_close_pct(T val, T expected, T percent)
|
||||
{
|
||||
constexpr T zero = T(0);
|
||||
assert(percent >= zero);
|
||||
constexpr T zero = T(0);
|
||||
assert(percent >= zero);
|
||||
|
||||
// Handle the zero cases
|
||||
if (percent == zero) return val == expected;
|
||||
T eps = (percent / T(100)) * std::max(std::abs(val), std::abs(expected));
|
||||
// Handle the zero cases
|
||||
if (percent == zero) return val == expected;
|
||||
T eps = (percent / T(100)) * std::max(std::abs(val), std::abs(expected));
|
||||
|
||||
return fptest_close(val, expected, eps);
|
||||
return fptest_close(val, expected, eps);
|
||||
}
|
||||
|
||||
|
||||
|
@ -185,7 +185,12 @@ check-generated-output)
|
||||
|
||||
# Reject patches that introduce non-ASCII characters or hard tabs.
|
||||
# Depends on LC_COLLATE set at the top of this script.
|
||||
! grep -rn '[^ -~]' libcxx/include/ || false
|
||||
! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test libcxx/benchmarks \
|
||||
--exclude '*.dat' \
|
||||
--exclude 'std_format_spec_string_unicode.bench.cpp' \
|
||||
--exclude 'grep.pass.cpp' \
|
||||
--exclude 'locale-specific_form.pass.cpp' \
|
||||
--exclude 'format_tests.h' || false
|
||||
|
||||
# Reject code with trailing whitespace
|
||||
! grep -rn '[[:blank:]]$' libcxx/include libcxx/src libcxx/test libcxx/benchmarks || false
|
||||
|
Loading…
Reference in New Issue
Block a user