From 3f388def3e3bf027b23f742c773d667a92c1e68e Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Mon, 5 Oct 2020 17:14:31 -0500 Subject: [PATCH] Enable y and d literals in C++14. --- .../time.cal.day/time.cal.day.nonmembers/literals.fail.cpp | 4 ++-- .../time.cal.day/time.cal.day.nonmembers/literals.pass.cpp | 6 +++--- libcxx/include/__config | 6 ------ libcxx/include/chrono | 6 ++---- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp b/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp index d7a359062e..64b196aa38 100644 --- a/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp +++ b/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: c++98, c++03, c++11 // UNSUPPORTED: clang-5, clang-6 // UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9, apple-clang-10 @@ -16,7 +16,7 @@ #include #include -#include +#include #include "test_macros.h" diff --git a/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp b/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp index 0d8f7a260c..446906a5b0 100644 --- a/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp +++ b/.upstream-tests/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp @@ -5,7 +5,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// UNSUPPORTED: c++98, c++03, c++11 // UNSUPPORTED: clang-5, clang-6, clang-7 // UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9 // UNSUPPORTED: apple-clang-10.0.0 @@ -17,7 +17,7 @@ #include #include -#include +#include #include "test_macros.h" @@ -34,7 +34,7 @@ int main(int, char**) } { - using namespace std::literals; + using namespace cuda::std::literals; ASSERT_NOEXCEPT( 4d); ASSERT_SAME_TYPE(cuda::std::chrono::day, decltype(4d)); diff --git a/libcxx/include/__config b/libcxx/include/__config index c3d3abaa0c..2a717e1edd 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -653,12 +653,6 @@ typedef __char32_t char32_t; #define _LIBCUDACXX_ALWAYS_INLINE __attribute__ ((__always_inline__)) -// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1 -#if (defined(_LIBCUDACXX_CLANG_VER) && _LIBCUDACXX_CLANG_VER < 800) || \ - (defined(__apple_build_version__) && __apple_build_version__ < 10010000) -#define _LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS -#endif - #if __has_feature(cxx_reference_qualified_functions) #define _LIBCUDACXX_HAS_REFERENCE_QUALIFIED_FUNCTIONS #endif diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 7d38d15a43..3ee0a7c8e0 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -3270,19 +3270,17 @@ inline namespace literals return chrono::duration (__ns); } -#if _LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS) _LIBCUDACXX_INLINE_VISIBILITY - constexpr chrono::day operator ""d(unsigned long long __d) noexcept + constexpr chrono::day operator""d(unsigned long long __d) noexcept { return chrono::day(static_cast(__d)); } _LIBCUDACXX_INLINE_VISIBILITY - constexpr chrono::year operator ""y(unsigned long long __y) noexcept + constexpr chrono::year operator""y(unsigned long long __y) noexcept { return chrono::year(static_cast(__y)); } -#endif }} namespace chrono { // hoist the literals into namespace std::chrono