summaryrefslogtreecommitdiff
path: root/test/std
diff options
context:
space:
mode:
Diffstat (limited to 'test/std')
-rw-r--r--test/std/containers/sequences/array/iterators.pass.cpp4
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp55
-rw-r--r--test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp8
-rw-r--r--test/std/iterators/iterator.range/begin-end.pass.cpp6
-rw-r--r--test/std/strings/string.view/string_view.literals/literal.pass.cpp57
-rw-r--r--test/std/strings/string.view/string_view.literals/literal1.fail.cpp23
-rw-r--r--test/std/strings/string.view/string_view.literals/literal1.pass.cpp25
-rw-r--r--test/std/strings/string.view/string_view.literals/literal2.fail.cpp21
-rw-r--r--test/std/strings/string.view/string_view.literals/literal2.pass.cpp25
-rw-r--r--test/std/strings/string.view/string_view.literals/literal3.pass.cpp25
-rw-r--r--test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h4
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp2
-rw-r--r--test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp2
14 files changed, 244 insertions, 15 deletions
diff --git a/test/std/containers/sequences/array/iterators.pass.cpp b/test/std/containers/sequences/array/iterators.pass.cpp
index 7d9050800dea..dd4aab30a026 100644
--- a/test/std/containers/sequences/array/iterators.pass.cpp
+++ b/test/std/containers/sequences/array/iterators.pass.cpp
@@ -132,10 +132,10 @@ int main()
static_assert ( std::rbegin(c) != std::rend(c), "");
static_assert ( std::cbegin(c) != std::cend(c), "");
static_assert ( std::crbegin(c) != std::crend(c), "");
-
+
static_assert ( *c.begin() == 0, "");
static_assert ( *c.rbegin() == 4, "");
-
+
static_assert ( *std::begin(c) == 0, "" );
static_assert ( *std::cbegin(c) == 0, "" );
static_assert ( *std::rbegin(c) == 4, "" );
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
new file mode 100644
index 000000000000..c5721f211abb
--- /dev/null
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.fail.cpp
@@ -0,0 +1,55 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03
+
+// <istream>
+
+// template <class charT, class traits = char_traits<charT> >
+// class basic_istream;
+
+// basic_istream(basic_istream const& rhs) = delete;
+// basic_istream& operator=(basic_istream const&) = delete;
+
+#include <istream>
+#include <type_traits>
+#include <cassert>
+
+struct test_istream
+ : public std::basic_istream<char>
+{
+ typedef std::basic_istream<char> base;
+
+ test_istream(test_istream&& s)
+ : base(std::move(s)) // OK
+ {
+ }
+
+ test_istream& operator=(test_istream&& s) {
+ base::operator=(std::move(s)); // OK
+ return *this;
+ }
+
+ test_istream(test_istream const& s)
+ : base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}}
+ {
+ }
+
+ test_istream& operator=(test_istream const& s) {
+ base::operator=(s); // expected-error {{call to deleted member function 'operator='}}
+ return *this;
+ }
+
+};
+
+
+int main()
+{
+
+}
diff --git a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
index 04cb9d3fb6ba..6e00f399306d 100644
--- a/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
+++ b/test/std/input.output/iostream.format/input.streams/istream/istream.cons/move.pass.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03
+
// <istream>
// template <class charT, class traits = char_traits<charT> >
@@ -17,8 +19,6 @@
#include <istream>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class CharT>
struct testbuf
: public std::basic_streambuf<CharT>
@@ -37,11 +37,8 @@ struct test_istream
: base(std::move(s)) {}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
int main()
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
testbuf<char> sb;
test_istream<char> is1(&sb);
@@ -74,5 +71,4 @@ int main()
assert(is.precision() == 6);
assert(is.getloc().name() == "C");
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
diff --git a/test/std/iterators/iterator.range/begin-end.pass.cpp b/test/std/iterators/iterator.range/begin-end.pass.cpp
index a0774888d567..2b5377f486f4 100644
--- a/test/std/iterators/iterator.range/begin-end.pass.cpp
+++ b/test/std/iterators/iterator.range/begin-end.pass.cpp
@@ -179,10 +179,10 @@ int main(){
static_assert ( std::rbegin(c) != std::rend(c), "");
static_assert ( std::cbegin(c) != std::cend(c), "");
static_assert ( std::crbegin(c) != std::crend(c), "");
-
+
static_assert ( *c.begin() == 0, "");
static_assert ( *c.rbegin() == 4, "");
-
+
static_assert ( *std::begin(c) == 0, "" );
static_assert ( *std::cbegin(c) == 0, "" );
static_assert ( *std::rbegin(c) == 4, "" );
@@ -191,7 +191,7 @@ int main(){
{
static constexpr const int c[] = {0,1,2,3,4};
-
+
static_assert ( *std::begin(c) == 0, "" );
static_assert ( *std::cbegin(c) == 0, "" );
static_assert ( *std::rbegin(c) == 4, "" );
diff --git a/test/std/strings/string.view/string_view.literals/literal.pass.cpp b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
new file mode 100644
index 000000000000..9fb128ab0f55
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal.pass.cpp
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ using namespace std::literals::string_view_literals;
+
+ static_assert ( std::is_same<decltype( "Hi"sv), std::string_view>::value, "" );
+ static_assert ( std::is_same<decltype( u8"Hi"sv), std::string_view>::value, "" );
+ static_assert ( std::is_same<decltype( L"Hi"sv), std::wstring_view>::value, "" );
+ static_assert ( std::is_same<decltype( u"Hi"sv), std::u16string_view>::value, "" );
+ static_assert ( std::is_same<decltype( U"Hi"sv), std::u32string_view>::value, "" );
+
+ std::string_view foo;
+ std::wstring_view Lfoo;
+ std::u16string_view ufoo;
+ std::u32string_view Ufoo;
+
+ foo = ""sv; assert( foo.size() == 0);
+ foo = u8""sv; assert( foo.size() == 0);
+ Lfoo = L""sv; assert(Lfoo.size() == 0);
+ ufoo = u""sv; assert(ufoo.size() == 0);
+ Ufoo = U""sv; assert(Ufoo.size() == 0);
+
+ foo = " "sv; assert( foo.size() == 1);
+ foo = u8" "sv; assert( foo.size() == 1);
+ Lfoo = L" "sv; assert(Lfoo.size() == 1);
+ ufoo = u" "sv; assert(ufoo.size() == 1);
+ Ufoo = U" "sv; assert(Ufoo.size() == 1);
+
+ foo = "ABC"sv; assert( foo == "ABC"); assert( foo == std::string_view ( "ABC"));
+ foo = u8"ABC"sv; assert( foo == u8"ABC"); assert( foo == std::string_view (u8"ABC"));
+ Lfoo = L"ABC"sv; assert(Lfoo == L"ABC"); assert(Lfoo == std::wstring_view ( L"ABC"));
+ ufoo = u"ABC"sv; assert(ufoo == u"ABC"); assert(ufoo == std::u16string_view( u"ABC"));
+ Ufoo = U"ABC"sv; assert(Ufoo == U"ABC"); assert(Ufoo == std::u32string_view( U"ABC"));
+
+ static_assert( "ABC"sv.size() == 3, "");
+ static_assert(u8"ABC"sv.size() == 3, "");
+ static_assert( L"ABC"sv.size() == 3, "");
+ static_assert( u"ABC"sv.size() == 3, "");
+ static_assert( U"ABC"sv.size() == 3, "");
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal1.fail.cpp b/test/std/strings/string.view/string_view.literals/literal1.fail.cpp
new file mode 100644
index 000000000000..6e6854f5559a
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal1.fail.cpp
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ using std::string_view;
+
+ string_view foo = ""sv; // should fail w/conversion operator not found
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal1.pass.cpp b/test/std/strings/string.view/string_view.literals/literal1.pass.cpp
new file mode 100644
index 000000000000..f663d022b2e1
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal1.pass.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ using namespace std::literals;
+
+ std::string_view foo = ""sv;
+ assert(foo.length() == 0);
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal2.fail.cpp b/test/std/strings/string.view/string_view.literals/literal2.fail.cpp
new file mode 100644
index 000000000000..4907a55104e0
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal2.fail.cpp
@@ -0,0 +1,21 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ std::string_view foo = ""sv; // should fail w/conversion operator not found
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal2.pass.cpp b/test/std/strings/string.view/string_view.literals/literal2.pass.cpp
new file mode 100644
index 000000000000..3bb6f6c0a0e3
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal2.pass.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ using namespace std::literals::string_view_literals;
+
+ std::string_view foo = ""sv;
+ assert(foo.length() == 0);
+}
diff --git a/test/std/strings/string.view/string_view.literals/literal3.pass.cpp b/test/std/strings/string.view/string_view.literals/literal3.pass.cpp
new file mode 100644
index 000000000000..144a1cdd1c8a
--- /dev/null
+++ b/test/std/strings/string.view/string_view.literals/literal3.pass.cpp
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9
+// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8
+// Note: libc++ supports string_view before C++17, but literals were introduced in C++14
+
+#include <string_view>
+#include <cassert>
+
+int main()
+{
+ using namespace std;
+
+ string_view foo = ""sv;
+ assert(foo.length() == 0);
+}
diff --git a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
index bae1e013f571..6b3f1e2ab0de 100644
--- a/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
+++ b/test/std/utilities/memory/util.smartptr/util.smartptr.shared/test_deleter.h
@@ -19,7 +19,9 @@
#include <type_traits>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
#define DELETE_FUNCTION = delete
#else
#define DELETE_FUNCTION { assert(false); }
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
index 624468671244..194e085ab04e 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=duration.pass.cpp
@@ -38,7 +38,7 @@ int main()
us1 %= std::chrono::milliseconds(3);
assert(us1.count() == 2);
}
-
+
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "");
#endif
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
index a4852d261f7e..7dcf002259bc 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_mod=rep.pass.cpp
@@ -34,7 +34,7 @@ int main()
us %= 3;
assert(us.count() == 2);
}
-
+
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "");
#endif
diff --git a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
index 0f76788c00ef..f3bf79035b0e 100644
--- a/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
+++ b/test/std/utilities/time/time.duration/time.duration.arithmetic/op_times=.pass.cpp
@@ -34,7 +34,7 @@ int main()
ns *= 5;
assert(ns.count() == 15);
}
-
+
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "");
#endif