[libcxx] r344535 - 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

Marshall Clow mclow.lists at gmail.com
Mon Oct 15 10:33:20 PDT 2018


Author: marshall
Date: Mon Oct 15 10:33:20 2018
New Revision: 344535

URL: http://llvm.org/viewvc/llvm-project?rev=344535&view=rev
Log:
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

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/chrono
    libcxx/trunk/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp
    libcxx/trunk/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=344535&r1=344534&r2=344535&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Oct 15 10:33:20 2018
@@ -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)))

Modified: libcxx/trunk/include/chrono
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=344535&r1=344534&r2=344535&view=diff
==============================================================================
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Mon Oct 15 10:33:20 2018
@@ -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));

Modified: libcxx/trunk/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp?rev=344535&r1=344534&r2=344535&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp Mon Oct 15 10:33:20 2018
@@ -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;

Modified: libcxx/trunk/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp?rev=344535&r1=344534&r2=344535&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp Mon Oct 15 10:33:20 2018
@@ -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;




More information about the libcxx-commits mailing list