test/std almost always uses spaces; now it is entirely tab-free.
llvm-svn: 329978
// int ia[] = {1, 2, 3, 4, 5};
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
//
-// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
-// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
-// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
-// ;
+// auto p = std::copy(std::begin(ia), std::end(ia), std::begin(ic));
+// return std::equal(std::begin(ia), std::end(ia), std::begin(ic), p)
+// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
+// ;
// }
// #endif
// int ia[] = {1, 2, 3, 4, 5};
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
//
-// size_t N = std::size(ia);
-// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
-// return std::equal(std::begin(ic), p, std::begin(ia))
-// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
-// ;
+// size_t N = std::size(ia);
+// auto p = std::copy_backward(std::begin(ia), std::end(ia), std::begin(ic) + N);
+// return std::equal(std::begin(ic), p, std::begin(ia))
+// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
+// ;
// }
// #endif
// int ia[] = {2, 4, 6, 8, 6};
// int ic[] = {0, 0, 0, 0, 0, 0};
//
-// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
-// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
-// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
-// ;
+// auto p = std::copy_if(std::begin(ia), std::end(ia), std::begin(ic), is6);
+// return std::all_of(std::begin(ic), p, [](int a){return a == 6;})
+// && std::all_of(p, std::end(ic), [](int a){return a == 0;})
+// ;
// }
// #endif
// int ia[] = {1, 2, 3, 4, 5};
// int ic[] = {6, 6, 6, 6, 6, 6, 6};
//
-// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
-// return std::equal(std::begin(ic), p, std::begin(ia))
-// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
-// ;
+// auto p = std::copy_n(std::begin(ia), 4, std::begin(ic));
+// return std::equal(std::begin(ic), p, std::begin(ia))
+// && std::all_of(p, std::end(ic), [](int a){return a == 6;})
+// ;
// }
// #endif
TEST_CONSTEXPR bool test_constexpr() {
int ia[] = {0, 1, 1, 3, 4};
const int expected[] = {0, 1, 3, 4};
- const size_t N = 4;
+ const size_t N = 4;
auto it = std::unique(std::begin(ia), std::end(ia));
return it == (std::begin(ia) + N)
TEST_CONSTEXPR bool test_constexpr() {
int ia[] = {0, 1, 1, 3, 4};
const int expected[] = {0, 1, 3, 4};
- const size_t N = 4;
+ const size_t N = 4;
auto it = std::unique(std::begin(ia), std::end(ia), [](int a, int b) {return a == b; });
return it == (std::begin(ia) + N)
//===----------------------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
+// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
// template <class... Args> decltype(auto) emplace(Args&&... args);
// return type is 'decltype(auto)' in C++17; 'void' before
-// whatever the return type of the underlying container's emplace_back() returns.
+// whatever the return type of the underlying container's emplace_back() returns.
#include <queue>
template <typename Queue>
void test_return_type() {
- typedef typename Queue::container_type Container;
- typedef typename Container::value_type value_type;
- typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
+ typedef typename Queue::container_type Container;
+ typedef typename Container::value_type value_type;
+ typedef decltype(std::declval<Queue>().emplace(std::declval<value_type &>())) queue_return_type;
#if TEST_STD_VER > 14
- typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
- static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
+ typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
+ static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
#else
- static_assert(std::is_same<queue_return_type, void>::value, "");
+ static_assert(std::is_same<queue_return_type, void>::value, "");
#endif
}
int main()
{
- test_return_type<std::queue<int> > ();
- test_return_type<std::queue<int, std::list<int> > > ();
+ test_return_type<std::queue<int> > ();
+ test_return_type<std::queue<int, std::list<int> > > ();
- typedef Emplaceable T;
- std::queue<Emplaceable> q;
+ typedef Emplaceable T;
+ std::queue<Emplaceable> q;
#if TEST_STD_VER > 14
- T& r1 = q.emplace(1, 2.5);
- assert(&r1 == &q.back());
- T& r2 = q.emplace(2, 3.5);
- assert(&r2 == &q.back());
- T& r3 = q.emplace(3, 4.5);
- assert(&r3 == &q.back());
- assert(&r1 == &q.front());
+ T& r1 = q.emplace(1, 2.5);
+ assert(&r1 == &q.back());
+ T& r2 = q.emplace(2, 3.5);
+ assert(&r2 == &q.back());
+ T& r3 = q.emplace(3, 4.5);
+ assert(&r3 == &q.back());
+ assert(&r1 == &q.front());
#else
- q.emplace(1, 2.5);
- q.emplace(2, 3.5);
- q.emplace(3, 4.5);
+ q.emplace(1, 2.5);
+ q.emplace(2, 3.5);
+ q.emplace(3, 4.5);
#endif
- assert(q.size() == 3);
- assert(q.front() == Emplaceable(1, 2.5));
- assert(q.back() == Emplaceable(3, 4.5));
+ assert(q.size() == 3);
+ assert(q.front() == Emplaceable(1, 2.5));
+ assert(q.back() == Emplaceable(3, 4.5));
}
template <class C>
class non_const_compare
{
-// operator() deliberately not marked as 'const'
- bool operator()(const C& x,const C&y) { return x < y; }
+// operator() deliberately not marked as 'const'
+ bool operator()(const C& x, const C& y) { return x < y; }
};
int main ()
{
- char buffer[100];
+ char buffer[100];
::operator new[](4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
}
int main ()
{
- char buffer[100];
+ char buffer[100];
::operator new(4, buffer); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
}
constexpr float gf = 8.f;
int main() {
- static_assert(std::launder(&gi) == &gi, "" );
- static_assert(std::launder(&gf) == &gf, "" );
+ static_assert(std::launder(&gi) == &gi, "" );
+ static_assert(std::launder(&gf) == &gf, "" );
- const int *i = &gi;
- const float *f = &gf;
+ const int *i = &gi;
+ const float *f = &gf;
static_assert(std::is_same<decltype(i), decltype(std::launder(i))>::value, "");
static_assert(std::is_same<decltype(f), decltype(std::launder(f))>::value, "");
- assert(std::launder(i) == i);
- assert(std::launder(f) == f);
+ assert(std::launder(i) == i);
+ assert(std::launder(f) == f);
}
// {
// public:
// // types:
-// using traits_type = traits;
-// using value_type = charT;
-// using pointer = value_type*;
-// using const_pointer = const value_type*;
-// using reference = value_type&;
-// using const_reference = const value_type&;
-// using const_iterator = implementation-defined ; // see 24.4.2.2
-// using iterator = const_iterator;
-// using const_reverse_iterator = reverse_iterator<const_iterator>;
-// using iterator = const_reverse_iterator;
-// using size_type = size_t;
-// using difference_type = ptrdiff_t;
-// static constexpr size_type npos = size_type(-1);
+// using traits_type = traits;
+// using value_type = charT;
+// using pointer = value_type*;
+// using const_pointer = const value_type*;
+// using reference = value_type&;
+// using const_reference = const value_type&;
+// using const_iterator = implementation-defined ; // see 24.4.2.2
+// using iterator = const_iterator;
+// using const_reverse_iterator = reverse_iterator<const_iterator>;
+// using iterator = const_reverse_iterator;
+// using size_type = size_t;
+// using difference_type = ptrdiff_t;
+// static constexpr size_type npos = size_type(-1);
//
// };
int main ()
{
- std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
- std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
-}
\ No newline at end of file
+ std::async( foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+ std::async(std::launch::async, foo, 3); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+}
test_remove_cvref<const volatile int, int>();
test_remove_cvref<volatile int, int>();
-// Doesn't decay
+// Doesn't decay
test_remove_cvref<int[3], int[3]>();
test_remove_cvref<int const [3], int[3]>();
test_remove_cvref<int volatile [3], int[3]>();