Forráskód Böngészése

Remove <experimental/numeric>; use <numeric> instead. See https://libcxx.llvm.org/TS_deprecation.html

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323975 91177308-0d34-0410-b5e6-96231b3b80d8
Marshall Clow 7 éve
szülő
commit
14698bce22
20 módosított fájl, 1 hozzáadás és 720 törlés
  1. 1 109
      include/experimental/numeric
  2. 0 4
      include/module.modulemap
  3. 0 1
      test/libcxx/double_include.sh.cpp
  4. 0 2
      test/libcxx/min_max_macros.sh.cpp
  5. 0 15
      test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
  6. 0 15
      test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
  7. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp
  8. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp
  9. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp
  10. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp
  11. 0 24
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
  12. 0 24
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
  13. 0 139
      test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
  14. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp
  15. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp
  16. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp
  17. 0 25
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp
  18. 0 24
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
  19. 0 24
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
  20. 0 139
      test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp

+ 1 - 109
include/experimental/numeric

@@ -8,112 +8,4 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP_EXPERIMENTAL_NUMERIC
-#define _LIBCPP_EXPERIMENTAL_NUMERIC
-/*
-    experimental/numeric synopsis
-
-// C++1z
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v2 {
-
-  // 13.1.2, Greatest common divisor
-  template<class M, class N>
-  constexpr common_type_t<M,N> gcd(M m, N n);
-
-  // 13.1.3, Least common multiple
-  template<class M, class N>
-  constexpr common_type_t<M,N> lcm(M m, N n);
-
-} // namespace fundamentals_v2
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <experimental/__config>
-#include <numeric>
-#include <type_traits>              // is_integral
-#include <limits>                   // numeric_limits
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-#if _LIBCPP_STD_VER > 11
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
-
-template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
-
-template <typename _Result, typename _Source>
-struct __abs<_Result, _Source, true> {
-    _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-    _Result operator()(_Source __t) const noexcept
-    {
-    if (__t >= 0) return __t;
-    if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
-    return -__t;
-    }
-};
-
-template <typename _Result, typename _Source>
-struct __abs<_Result, _Source, false> {
-    _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-    _Result operator()(_Source __t) const noexcept { return __t; }
-};
-
-
-template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
-inline _Tp __gcd(_Tp __m, _Tp __n)
-{
-    static_assert((!is_signed<_Tp>::value), "" );
-    return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n);
-}
-
-
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-common_type_t<_Tp,_Up>
-gcd(_Tp __m, _Up __n)
-{
-    static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
-    static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" );
-    static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" );
-    using _Rp = common_type_t<_Tp,_Up>;
-    using _Wp = make_unsigned_t<_Rp>;
-    return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd(
-      static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
-      static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
-}
-
-template<class _Tp, class _Up>
-_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-common_type_t<_Tp,_Up>
-lcm(_Tp __m, _Up __n)
-{
-    static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
-    static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" );
-    static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" );
-    if (__m == 0 || __n == 0)
-        return 0;
-
-    using _Rp = common_type_t<_Tp,_Up>;
-    _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n);
-    _Rp __val2 = __abs<_Rp, _Up>()(__n);
-    _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
-    return __val1 * __val2;
-}
-
-_LIBCPP_END_NAMESPACE_LFTS_V2
-
-#endif /* _LIBCPP_STD_VER > 11 */
-
-_LIBCPP_POP_MACROS
-
-#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */
+#error "<experimental/numeric> has been removed. Use <numeric> instead."

+ 0 - 4
include/module.modulemap

@@ -538,10 +538,6 @@ module std [system] {
       header "experimental/memory_resource"
       export *
     }
-    module numeric {
-      header "experimental/numeric"
-      export *
-    }
     module propagate_const {
       header "experimental/propagate_const"
       export *

+ 0 - 1
test/libcxx/double_include.sh.cpp

@@ -148,7 +148,6 @@
 #include <experimental/list>
 #include <experimental/map>
 #include <experimental/memory_resource>
-#include <experimental/numeric>
 #include <experimental/propagate_const>
 #include <experimental/ratio>
 #include <experimental/regex>

+ 0 - 2
test/libcxx/min_max_macros.sh.cpp

@@ -257,8 +257,6 @@ TEST_MACROS();
 TEST_MACROS();
 #include <experimental/memory_resource>
 TEST_MACROS();
-#include <experimental/numeric>
-TEST_MACROS();
 #include <experimental/propagate_const>
 TEST_MACROS();
 #include <experimental/ratio>

+ 0 - 15
test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp

@@ -1,15 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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>
-
-#include <experimental/numeric>
-
-int main () {}

+ 0 - 15
test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp

@@ -1,15 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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>
-
-#include <experimental/numeric>
-
-int main () {}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 24
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp

@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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, the program is ill-formed.
-
-#include <experimental/numeric>
-
-
-int main()
-{
-    std::experimental::gcd(2.0, 4);
-}

+ 0 - 24
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp

@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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, the program is ill-formed.
-
-#include <experimental/numeric>
-
-
-int main()
-{
-    std::experimental::gcd(4, 6.0);
-}

+ 0 - 139
test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp

@@ -1,139 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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)
-
-#include <experimental/numeric>
-#include <cassert>
-#include <cstdlib>    // for rand()
-#include <iostream>
-
-constexpr struct {
-  int x;
-  int y;
-  int expect;
-} Cases[] = {
-    {0, 0, 0},
-    {1, 0, 1},
-    {0, 1, 1},
-    {1, 1, 1},
-    {2, 3, 1},
-    {2, 4, 2},
-    {36, 17, 1},
-    {36, 18, 18}
-};
-
-
-template <typename Input1, typename Input2, typename Output>
-constexpr bool test0(Input1 in1, Input2 in2, Output out)
-{
-    static_assert((std::is_same<Output, decltype(std::experimental::gcd(in1, in2))>::value), "" );
-    static_assert((std::is_same<Output, decltype(std::experimental::gcd(in2, in1))>::value), "" );
-    return out == std::experimental::gcd(in1, in2) ? true : (std::abort(), false);
-}
-
-
-template <typename Input1, typename Input2 = Input1>
-constexpr bool do_test(int = 0)
-{
-    using S1 = typename std::make_signed<Input1>::type;
-    using S2 = typename std::make_signed<Input2>::type;
-    using U1 = typename std::make_unsigned<Input1>::type;
-    using U2 = typename std::make_unsigned<Input2>::type;
-    bool accumulate = true;
-    for (auto TC : Cases) {
-        { // Test with two signed types
-            using Output = std::common_type_t<S1, S2>;
-            accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
-        }
-        { // test with two unsigned types
-            using Output = std::common_type_t<U1, U2>;
-            accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
-        }
-        { // Test with mixed signs
-            using Output = std::common_type_t<S1, U2>;
-            accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
-        }
-        { // Test with mixed signs
-            using Output = std::common_type_t<S2, U1>;
-            accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
-        }
-    }
-    return accumulate;
-}
-
-int main()
-{
-    auto non_cce = std::rand(); // a value that can't possibly be constexpr
-
-    static_assert(do_test<signed char>(), "");
-    static_assert(do_test<short>(), "");
-    static_assert(do_test<int>(), "");
-    static_assert(do_test<long>(), "");
-    static_assert(do_test<long long>(), "");
-
-    assert(do_test<signed char>(non_cce));
-    assert(do_test<short>(non_cce));
-    assert(do_test<int>(non_cce));
-    assert(do_test<long>(non_cce));
-    assert(do_test<long long>(non_cce));
-
-    static_assert(do_test< int8_t>(), "");
-    static_assert(do_test<int16_t>(), "");
-    static_assert(do_test<int32_t>(), "");
-    static_assert(do_test<int64_t>(), "");
-
-    assert(do_test< int8_t>(non_cce));
-    assert(do_test<int16_t>(non_cce));
-    assert(do_test<int32_t>(non_cce));
-    assert(do_test<int64_t>(non_cce));
-
-    static_assert(do_test<signed char, int>(), "");
-    static_assert(do_test<int, signed char>(), "");
-    static_assert(do_test<short, int>(), "");
-    static_assert(do_test<int, short>(), "");
-    static_assert(do_test<int, long>(), "");
-    static_assert(do_test<long, int>(), "");
-    static_assert(do_test<int, long long>(), "");
-    static_assert(do_test<long long, int>(), "");
-
-    assert((do_test<signed char, int>(non_cce)));
-    assert((do_test<int, signed char>(non_cce)));
-    assert((do_test<short, int>(non_cce)));
-    assert((do_test<int, short>(non_cce)));
-    assert((do_test<int, long>(non_cce)));
-    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);
-    }
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 25
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp

@@ -1,25 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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);
-}

+ 0 - 24
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp

@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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, the program is ill-formed.
-
-#include <experimental/numeric>
-
-
-int main()
-{
-    std::experimental::lcm(2.0, 4);
-}

+ 0 - 24
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp

@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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, the program is ill-formed.
-
-#include <experimental/numeric>
-
-
-int main()
-{
-    std::experimental::lcm(4, 6.0);
-}

+ 0 - 139
test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp

@@ -1,139 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-//                     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)
-
-#include <experimental/numeric>
-#include <cassert>
-#include <cstdlib>
-#include <iostream>
-
-constexpr struct {
-  int x;
-  int y;
-  int expect;
-} Cases[] = {
-    {0, 0, 0},
-    {1, 0, 0},
-    {0, 1, 0},
-    {1, 1, 1},
-    {2, 3, 6},
-    {2, 4, 4},
-    {3, 17, 51},
-    {36, 18, 36}
-};
-
-template <typename Input1, typename Input2, typename Output>
-constexpr bool test0(Input1 in1, Input2 in2, Output out)
-{
-    static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input1(0), Input2(0)))>::value), "" );
-    static_assert((std::is_same<Output, decltype(std::experimental::lcm(Input2(0), Input1(0)))>::value), "" );
-    return out == std::experimental::lcm(in1, in2) ? true : (std::abort(), false);
-}
-
-
-template <typename Input1, typename Input2 = Input1>
-constexpr bool do_test(int = 0)
-{
-    using S1 = typename std::make_signed<Input1>::type;
-    using S2 = typename std::make_signed<Input2>::type;
-    using U1 = typename std::make_unsigned<Input1>::type;
-    using U2 = typename std::make_unsigned<Input2>::type;
-    bool accumulate = true;
-    for (auto TC : Cases) {
-        { // Test with two signed types
-            using Output = std::common_type_t<S1, S2>;
-            accumulate &= test0<S1, S2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S1, S2, Output>(-TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(TC.x, -TC.y, TC.expect);
-            accumulate &= test0<S2, S1, Output>(-TC.x, -TC.y, TC.expect);
-        }
-        { // test with two unsigned types
-            using Output = std::common_type_t<U1, U2>;
-            accumulate &= test0<U1, U2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, U1, Output>(TC.x, TC.y, TC.expect);
-        }
-        { // Test with mixed signs
-            using Output = std::common_type_t<S1, U2>;
-            accumulate &= test0<S1, U2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, S1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S1, U2, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<U2, S1, Output>(TC.x, -TC.y, TC.expect);
-        }
-        { // Test with mixed signs
-            using Output = std::common_type_t<S2, U1>;
-            accumulate &= test0<S2, U1, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<U1, S2, Output>(TC.x, TC.y, TC.expect);
-            accumulate &= test0<S2, U1, Output>(-TC.x, TC.y, TC.expect);
-            accumulate &= test0<U1, S2, Output>(TC.x, -TC.y, TC.expect);
-        }
-    }
-    return accumulate;
-}
-
-int main()
-{
-    auto non_cce = std::rand(); // a value that can't possibly be constexpr
-
-    static_assert(do_test<signed char>(), "");
-    static_assert(do_test<short>(), "");
-    static_assert(do_test<int>(), "");
-    static_assert(do_test<long>(), "");
-    static_assert(do_test<long long>(), "");
-
-    assert(do_test<signed char>(non_cce));
-    assert(do_test<short>(non_cce));
-    assert(do_test<int>(non_cce));
-    assert(do_test<long>(non_cce));
-    assert(do_test<long long>(non_cce));
-
-    static_assert(do_test< int8_t>(), "");
-    static_assert(do_test<int16_t>(), "");
-    static_assert(do_test<int32_t>(), "");
-    static_assert(do_test<int64_t>(), "");
-
-    assert(do_test< int8_t>(non_cce));
-    assert(do_test<int16_t>(non_cce));
-    assert(do_test<int32_t>(non_cce));
-    assert(do_test<int64_t>(non_cce));
-
-    static_assert(do_test<signed char, int>(), "");
-    static_assert(do_test<int, signed char>(), "");
-    static_assert(do_test<short, int>(), "");
-    static_assert(do_test<int, short>(), "");
-    static_assert(do_test<int, long>(), "");
-    static_assert(do_test<long, int>(), "");
-    static_assert(do_test<int, long long>(), "");
-    static_assert(do_test<long long, int>(), "");
-
-    assert((do_test<signed char, int>(non_cce)));
-    assert((do_test<int, signed char>(non_cce)));
-    assert((do_test<short, int>(non_cce)));
-    assert((do_test<int, short>(non_cce)));
-    assert((do_test<int, long>(non_cce)));
-    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);
-    }
-}