diff options
Diffstat (limited to 'test/std/experimental')
29 files changed, 333 insertions, 39 deletions
diff --git a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp index 531731791c5d0..23098d83e4ea6 100644 --- a/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp +++ b/test/std/experimental/algorithms/alg.random.sample/sample.pass.cpp @@ -58,19 +58,23 @@ void test() { const unsigned os = Expectations::os; SampleItem oa[os]; const int *oa1 = Expectations::oa1; + ((void)oa1); // Prevent unused warning const int *oa2 = Expectations::oa2; + ((void)oa2); // Prevent unused warning std::minstd_rand g; SampleIterator end; end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, g); - assert(end.base() - oa == std::min(os, is)); - assert(std::equal(oa, oa + os, oa1)); + assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is)); + // sample() is deterministic but non-reproducible; + // its results can vary between implementations. + LIBCPP_ASSERT(std::equal(oa, oa + os, oa1)); end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, std::move(g)); - assert(end.base() - oa == std::min(os, is)); - assert(std::equal(oa, oa + os, oa2)); + assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is)); + LIBCPP_ASSERT(std::equal(oa, oa + os, oa2)); } template <template<class...> class PopulationIteratorType, class PopulationItem, @@ -119,7 +123,7 @@ void test_small_population() { end = std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is), SampleIterator(oa), os, g); - assert(end.base() - oa == std::min(os, is)); + assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is)); assert(std::equal(oa, end.base(), oa1)); } diff --git a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp index 585b0bb1dd5ee..a744e659f5b5b 100644 --- a/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp +++ b/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp @@ -30,8 +30,8 @@ int main() { { static_assert(std::is_nothrow_default_constructible<file_status>::value, "The default constructor must be noexcept"); - static_assert(!test_convertible<file_status>(), - "The default constructor must be explicit"); + static_assert(test_convertible<file_status>(), + "The default constructor must not be explicit"); const file_status f; assert(f.type() == file_type::none); assert(f.permissions() == perms::unknown); diff --git a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp index f344e11530718..a6172d1981cf6 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.append.pass.cpp @@ -131,7 +131,7 @@ void doAppendSourceAllocTest(AppendOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp new file mode 100644 index 0000000000000..c5da52f652483 --- /dev/null +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/braced_init.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +// <experimental/filesystem> + +// class path + +// path& operator=(path const&); + +#include <experimental/filesystem> +#include <type_traits> +#include <cassert> + +#include "test_macros.h" +#include "count_new.hpp" + +namespace fs = std::experimental::filesystem; + +int main() { + using namespace fs; + path p("abc"); + p = {}; + assert(p.native() == ""); +} diff --git a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp index 9e48cbf1e7f21..8c31ef51d9448 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.assign/source.pass.cpp @@ -15,6 +15,7 @@ // template <class Source> // path& operator=(Source const&); +// path& operator=(string_type&&); // template <class Source> // path& assign(Source const&); // template <class InputIterator> @@ -49,7 +50,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string<CharT> S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -75,7 +76,7 @@ void RunTestCase(MultiStringType const& MS) { const std::basic_string_view<CharT> S(TestPath); path p; PathReserve(p, S.length() + 1); { - // string provides a contigious iterator. No allocation needed. + // string provides a contiguous iterator. No allocation needed. DisableAllocationGuard g; path& pref = (p = S); assert(&pref == &p); @@ -101,7 +102,7 @@ void RunTestCase(MultiStringType const& MS) { { path p; PathReserve(p, Size + 1); { - // char* pointers are contigious and can be used with code_cvt directly. + // char* pointers are contiguous and can be used with code_cvt directly. // no allocations needed. DisableAllocationGuard g; path& pref = (p = TestPath); @@ -213,12 +214,29 @@ void test_sfinae() { } } +void RunStringMoveTest(const char* Expect) { + using namespace fs; + std::string ss(Expect); + path p; + { + DisableAllocationGuard g; ((void)g); + path& pr = (p = std::move(ss)); + assert(&pr == &p); + } + assert(p == Expect); + { + // Signature test + ASSERT_NOEXCEPT(p = std::move(ss)); + } +} + int main() { for (auto const& MS : PathList) { RunTestCase<char>(MS); RunTestCase<wchar_t>(MS); RunTestCase<char16_t>(MS); RunTestCase<char32_t>(MS); + RunStringMoveTest(MS); } test_sfinae(); } diff --git a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp index 89269362d06fe..76df0e9eef76a 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.concat.pass.cpp @@ -132,7 +132,7 @@ void doConcatSourceAllocTest(ConcatOperatorTestcase const& TC) assert(LHS == E); } // input iterator - For non-native char types, appends needs to copy the - // iterator range into a contigious block of memory before it can perform the + // iterator range into a contiguous block of memory before it can perform the // code_cvt conversions. // For "char" no allocations will be performed because no conversion is // required. diff --git a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp index 4c83481aaf2d8..078e006663e93 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.decompose/path.decompose.pass.cpp @@ -54,12 +54,6 @@ #include "count_new.hpp" #include "filesystem_test_helper.hpp" -template <class It> -std::reverse_iterator<It> mkRev(It it) { - return std::reverse_iterator<It>(it); -} - - namespace fs = std::experimental::filesystem; struct PathDecomposeTestcase { @@ -147,7 +141,11 @@ void decompPathTest() assert(checkCollectionsEqual(p.begin(), p.end(), TC.elements.begin(), TC.elements.end())); // check backwards - assert(checkCollectionsEqual(mkRev(p.end()), mkRev(p.begin()), + + std::vector<fs::path> Parts; + for (auto it = p.end(); it != p.begin(); ) + Parts.push_back(*--it); + assert(checkCollectionsEqual(Parts.begin(), Parts.end(), TC.elements.rbegin(), TC.elements.rend())); } } diff --git a/test/std/experimental/filesystem/class.path/synop.pass.cpp b/test/std/experimental/filesystem/class.path/synop.pass.cpp index b0a7b5cd65e21..883feb287d06c 100644 --- a/test/std/experimental/filesystem/class.path/synop.pass.cpp +++ b/test/std/experimental/filesystem/class.path/synop.pass.cpp @@ -32,7 +32,7 @@ int main() { { ASSERT_SAME_TYPE(const path::value_type, decltype(path::preferred_separator)); static_assert(path::preferred_separator == '/', ""); - // Make preferred_separator ODR used by taking it's address. + // Make preferred_separator ODR used by taking its address. const char* dummy = &path::preferred_separator; ((void)dummy); } diff --git a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp index e67fc2f20f6ef..26fc3ca28d8e9 100644 --- a/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp +++ b/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp @@ -175,7 +175,7 @@ TEST_CASE(access_denied_on_recursion_test_case) TEST_CHECK(ec); TEST_CHECK(it == endIt); } - // Same as obove but test operator++(). + // Same as above but test operator++(). { std::error_code ec = GetTestEC(); recursive_directory_iterator it(startDir, ec); @@ -222,7 +222,7 @@ TEST_CASE(access_denied_on_recursion_test_case) TEST_REQUIRE(ec); TEST_REQUIRE(it == endIt); } - // Same as obove but testing the throwing constructors + // Same as above but testing the throwing constructors { TEST_REQUIRE_THROW(filesystem_error, recursive_directory_iterator(permDeniedDir)); diff --git a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp index d8d92c5888ac6..447fb46e840b9 100644 --- a/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp +++ b/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp @@ -18,8 +18,8 @@ #include <type_traits> // system_clock is used because it meets the requirements of TrivialClock, -// and it's resolution and range of system_clock should match the operating -// systems file time type. +// and the resolution and range of system_clock should match the operating +// system's file time type. typedef std::chrono::system_clock ExpectedClock; typedef std::chrono::time_point<ExpectedClock> ExpectedTimePoint; diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp index 4d59235c722b8..28e945b689703 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.absolute/absolute.pass.cpp @@ -54,7 +54,7 @@ TEST_CASE(absolute_path_test) TEST_REQUIRE(not p.has_root_name()); TEST_REQUIRE(p.has_root_directory()); TEST_CHECK(p.is_absolute()); - // ensure absolute(base) is not recursivly called + // ensure absolute(base) is not recursively called TEST_REQUIRE(base.has_root_name()); TEST_REQUIRE(base.has_root_directory()); @@ -73,7 +73,7 @@ TEST_CASE(absolute_path_test) TEST_REQUIRE(p.has_root_name()); TEST_REQUIRE(not p.has_root_directory()); TEST_CHECK(not p.is_absolute()); - // absolute is called recursivly on base. The following conditions + // absolute is called recursively on base. The following conditions // must be true for it to return base unmodified TEST_REQUIRE(base.has_root_name()); TEST_REQUIRE(base.has_root_directory()); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp index 252ced6fd65fa..2b9f57e7e9542 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.exists/exists.pass.cpp @@ -85,4 +85,13 @@ TEST_CASE(test_exists_fails) TEST_CHECK_THROW(filesystem_error, exists(file)); } +TEST_CASE(test_name_too_long) { + std::string long_name(2500, 'a'); + const path file(long_name); + + std::error_code ec; + TEST_CHECK(exists(file, ec) == false); + TEST_CHECK(ec); +} + TEST_SUITE_END() diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp index 4177392141e54..794aeb992640d 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.permissions/permissions.pass.cpp @@ -144,7 +144,7 @@ TEST_CASE(test_no_resolve_symlink_on_symlink) std::error_code expected_ec; #else // On linux symlink permissions are not supported. The error code should - // be 'operation_not_supported' and the sylink permissions should be + // be 'operation_not_supported' and the symlink permissions should be // unchanged. const auto expected_link_perms = symlink_status(sym).permissions(); std::error_code expected_ec = std::make_error_code(std::errc::operation_not_supported); diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp index 2c76caf74c847..fdc3d2b4a61ff 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.status/status.pass.cpp @@ -65,29 +65,36 @@ TEST_CASE(test_status_cannot_resolve) const std::error_code set_ec = std::make_error_code(std::errc::address_in_use); - const std::error_code expect_ec = + const std::error_code perm_ec = std::make_error_code(std::errc::permission_denied); + const std::error_code name_too_long_ec = + std::make_error_code(std::errc::filename_too_long); - const path cases[] = { - file, sym + struct TestCase { + path p; + std::error_code expect_ec; + } const TestCases[] = { + {file, perm_ec}, + {sym, perm_ec}, + {path(std::string(2500, 'a')), name_too_long_ec} }; - for (auto& p : cases) + for (auto& TC : TestCases) { { // test non-throwing case std::error_code ec = set_ec; - file_status st = status(p, ec); - TEST_CHECK(ec == expect_ec); + file_status st = status(TC.p, ec); + TEST_CHECK(ec == TC.expect_ec); TEST_CHECK(st.type() == file_type::none); TEST_CHECK(st.permissions() == perms::unknown); } #ifndef TEST_HAS_NO_EXCEPTIONS { // test throwing case try { - status(p); + status(TC.p); } catch (filesystem_error const& err) { - TEST_CHECK(err.path1() == p); + TEST_CHECK(err.path1() == TC.p); TEST_CHECK(err.path2() == ""); - TEST_CHECK(err.code() == expect_ec); + TEST_CHECK(err.code() == TC.expect_ec); } } #endif diff --git a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp index 148564e61961e..021dd7fc81608 100644 --- a/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp +++ b/test/std/experimental/filesystem/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp @@ -97,6 +97,14 @@ TEST_CASE(basic_tests) TEST_CHECK(ec == std::make_error_code(std::errc::permission_denied)); TEST_CHECK(ret == ""); + // Set the env variable to point to a non-existent dir + PutEnv(TC.name, TC.p / "does_not_exist"); + ec = GetTestEC(); + ret = temp_directory_path(ec); + TEST_CHECK(ec != GetTestEC()); + TEST_CHECK(ec); + TEST_CHECK(ret == ""); + // Finally erase this env variable UnsetEnv(TC.name); } diff --git a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp index a02dcf336960a..3e83173555be0 100644 --- a/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp +++ b/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp @@ -120,7 +120,7 @@ void test_pmr_uses_alloc(Args&&... args) } { // Test that T(std::allocator_arg_t, Alloc const&, Args...) construction - // is prefered when T(Args..., Alloc const&) is also available. + // is preferred when T(Args..., Alloc const&) is also available. using T = UsesAllocatorV3<Alloc, sizeof...(Args)>; assert((doTest<T>(UA_AllocArg, std::forward<Args>(args)...))); } diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp new file mode 100644 index 0000000000000..c8d6c5367d7ef --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::gcd(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp new file mode 100644 index 0000000000000..a3a2206fba632 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::gcd(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp new file mode 100644 index 0000000000000..1f04580ddabd4 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::gcd<volatile bool, int>(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp new file mode 100644 index 0000000000000..1f0e8a2b3a2ff --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> gcd(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::gcd<int, const bool>(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp index a52b50b391cd3..3f86cfe4c7f06 100644 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp @@ -129,4 +129,11 @@ int main() assert((do_test<long, int>(non_cce))); assert((do_test<int, long long>(non_cce))); assert((do_test<long long, int>(non_cce))); + +// LWG#2792 + { + auto res = std::experimental::gcd((int64_t)1234, (int32_t)-2147483648); + static_assert( std::is_same<decltype(res), std::common_type<int64_t, int32_t>::type>::value, ""); + assert(res == 2); + } } diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp new file mode 100644 index 0000000000000..e4c2ed8bf5396 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::lcm(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp new file mode 100644 index 0000000000000..097b23eae6e43 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::lcm(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp new file mode 100644 index 0000000000000..d5e6300818ccb --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::lcm<volatile bool, int>(false, 4); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp new file mode 100644 index 0000000000000..d88c490d64bf7 --- /dev/null +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// <numeric> + +// template<class _M, class _N> +// constexpr common_type_t<_M,_N> lcm(_M __m, _N __n) + +// Remarks: If either M or N is not an integer type, +// or if either is (a possibly cv-qualified) bool, the program is ill-formed. + +#include <experimental/numeric> + + +int main() +{ + std::experimental::lcm<int, const bool>(2, true); +} diff --git a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp index e3c109f7447b3..fd463e88e63f6 100644 --- a/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp +++ b/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp @@ -128,4 +128,12 @@ int main() assert((do_test<long, int>(non_cce))); assert((do_test<int, long long>(non_cce))); assert((do_test<long long, int>(non_cce))); + +// LWG#2792 + { + auto res1 = std::experimental::lcm((int64_t)1234, (int32_t)-2147483648); + (void) std::experimental::lcm<int, unsigned long>(INT_MIN, 2); // this used to trigger UBSAN + static_assert( std::is_same<decltype(res1), std::common_type<int64_t, int32_t>::type>::value, ""); + assert(res1 == 1324997410816LL); + } } diff --git a/test/std/experimental/string.view/lit.local.cfg b/test/std/experimental/string.view/lit.local.cfg new file mode 100644 index 0000000000000..376dbe7c16ec9 --- /dev/null +++ b/test/std/experimental/string.view/lit.local.cfg @@ -0,0 +1,3 @@ +# Disable all of the filesystem tests if the correct feature is not available. +if 'msvc' in config.available_features: + config.unsupported = True diff --git a/test/std/experimental/string.view/string.view.access/at.pass.cpp b/test/std/experimental/string.view/string.view.access/at.pass.cpp index 7ceaf5ab3d9f3..eaea062987fb3 100644 --- a/test/std/experimental/string.view/string.view.access/at.pass.cpp +++ b/test/std/experimental/string.view/string.view.access/at.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// NOTE: Older versions of clang have a bug where they fail to evalute +// NOTE: Older versions of clang have a bug where they fail to evaluate // string_view::at as a constant expression. // XFAIL: clang-3.4, clang-3.3 diff --git a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp index 0c5170f29cea9..57dff44976bc8 100644 --- a/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp +++ b/test/std/experimental/utilities/tuple/tuple.apply/extended_types.pass.cpp @@ -13,7 +13,7 @@ // template <class F, class T> constexpr decltype(auto) apply(F &&, T &&) -// Testing extended function types. The extented function types are those +// Testing extended function types. The extended function types are those // named by INVOKE but that are not actual callable objects. These include // bullets 1-4 of invoke. |