diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2018-10-15 17:33:20 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2018-10-15 17:33:20 +0000 |
commit | 323e01d46fad7a66c3f44c7ab41b319ad3c454bc (patch) | |
tree | 9e861168037f2466612d38565ac632cce99917b8 /libcxx | |
parent | 8bd74785f0a29510805fa38a3e4f4bd8b6bceefd (diff) | |
download | bcm5719-llvm-323e01d46fad7a66c3f44c7ab41b319ad3c454bc.tar.gz bcm5719-llvm-323e01d46fad7a66c3f44c7ab41b319ad3c454bc.zip |
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
llvm-svn: 344535
Diffstat (limited to 'libcxx')
4 files changed, 10 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index 14ecb8fb426..7e47f44790c 100644 --- a/libcxx/include/__config +++ b/libcxx/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/libcxx/include/chrono b/libcxx/include/chrono index 1812df8f495..75258abd26b 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -2668,7 +2668,7 @@ inline namespace literals return chrono::duration<long double, nano> (__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<unsigned>(__d)); diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp index a442bb9514a..0911b43b54b 100644 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp +++ b/libcxx/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 // <chrono> // class day; diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp index 92b701f8bc2..6ace2932424 100644 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp +++ b/libcxx/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 // <chrono> // class year; |