From 1b8e2004704c98c05429a5c1f08e492a0ce33529 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 15 Oct 2018 17:33:20 +0000 Subject: [PATCH] Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344535 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__config | 5 +++++ include/chrono | 2 +- .../time.cal.day/time.cal.day.nonmembers/literals.pass.cpp | 2 ++ .../time.cal.year/time.cal.year.nonmembers/literals.pass.cpp | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/__config b/include/__config index 14ecb8fb4..7e47f4479 100644 --- a/include/__config +++ b/include/__config @@ -492,6 +492,11 @@ namespace std { #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +// No apple compilers support ""d and ""y at this time. +#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__) +#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS +#endif + #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) diff --git a/include/chrono b/include/chrono index 1812df8f4..75258abd2 100644 --- a/include/chrono +++ b/include/chrono @@ -2668,7 +2668,7 @@ inline namespace literals return chrono::duration (__ns); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS) constexpr chrono::day operator ""d(unsigned long long __d) noexcept { return chrono::day(static_cast(__d)); diff --git a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp index a442bb951..0911b43b5 100644 --- a/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp +++ b/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-5, clang-6 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9 // // class day; diff --git a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp index 92b701f8b..6ace29324 100644 --- a/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp +++ b/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: clang-5, clang-6 +// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9 // // class year;