[libcxx] r292962 - Implement LWG2733: [fund.ts.v2] gcd / lcm and bool. We already did tbis for C++17, so replicate the changes in experimental.
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 24 10:15:48 PST 2017
Author: marshall
Date: Tue Jan 24 12:15:48 2017
New Revision: 292962
URL: http://llvm.org/viewvc/llvm-project?rev=292962&view=rev
Log:
Implement LWG2733: [fund.ts.v2] gcd / lcm and bool. We already did tbis for C++17, so replicate the changes in experimental.
Added:
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp
libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp
- copied, changed from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp
Modified:
libcxx/trunk/include/experimental/numeric
Modified: libcxx/trunk/include/experimental/numeric
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/numeric?rev=292962&r1=292961&r2=292962&view=diff
==============================================================================
--- libcxx/trunk/include/experimental/numeric (original)
+++ libcxx/trunk/include/experimental/numeric Tue Jan 24 12:15:48 2017
@@ -75,6 +75,8 @@ 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>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
@@ -87,6 +89,8 @@ 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;
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool1.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::gcd(false, 4);
+ std::experimental::gcd(false, 4);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool2.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::gcd(2, true);
+ std::experimental::gcd(2, true);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool3.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::gcd<volatile bool, int>(false, 4);
+ std::experimental::gcd<volatile bool, int>(false, 4);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.bool4.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::gcd<int, const bool>(2, true);
+ std::experimental::gcd<int, const bool>(2, true);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool1.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::lcm(false, 4);
+ std::experimental::lcm(false, 4);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool2.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::lcm(2, true);
+ std::experimental::lcm(2, true);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool3.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::lcm<volatile bool, int>(false, 4);
+ std::experimental::lcm<volatile bool, int>(false, 4);
}
Copied: libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp (from r292937, libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp?p2=libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp&p1=libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp&r1=292937&r2=292962&rev=292962&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp (original)
+++ libcxx/trunk/test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.bool4.fail.cpp Tue Jan 24 12:15:48 2017
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// UNSUPPORTED: c++98, c++03, c++11, c++14
+// UNSUPPORTED: c++98, c++03, c++11
// <numeric>
// template<class _M, class _N>
@@ -16,10 +16,10 @@
// 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 <numeric>
+#include <experimental/numeric>
int main()
{
- std::lcm<int, const bool>(2, true);
+ std::experimental::lcm<int, const bool>(2, true);
}
More information about the cfe-commits
mailing list