[llvm] r294327 - Attempt to fix MSVC build broken by r294326

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 10:35:36 PST 2017


Author: labath
Date: Tue Feb  7 12:35:36 2017
New Revision: 294327

URL: http://llvm.org/viewvc/llvm-project?rev=294327&view=rev
Log:
Attempt to fix MSVC build broken by r294326

MSVC does not think that `char []` can be constexpr. Switch to regular const.

Modified:
    llvm/trunk/include/llvm/Support/Chrono.h
    llvm/trunk/lib/Support/Chrono.cpp

Modified: llvm/trunk/include/llvm/Support/Chrono.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Chrono.h?rev=294327&r1=294326&r2=294327&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Chrono.h (original)
+++ llvm/trunk/include/llvm/Support/Chrono.h Tue Feb  7 12:35:36 2017
@@ -76,21 +76,15 @@ raw_ostream &operator<<(raw_ostream &OS,
 ///  display unit or you request that the unit is not displayed.
 
 namespace detail {
-template <typename Period> struct unit { static constexpr char value[] = ""; };
-template <typename Period> constexpr char unit<Period>::value[];
+template <typename Period> struct unit { static const char value[]; };
+template <typename Period> const char unit<Period>::value[] = "";
 
-template <> struct unit<std::ratio<3600>> {
-  static constexpr char value[] = "h";
-};
-
-template <> struct unit<std::ratio<60>> {
-  static constexpr char value[] = "m";
-};
-
-template <> struct unit<std::ratio<1>> { static constexpr char value[] = "s"; };
-template <> struct unit<std::milli> { static constexpr char value[] = "ms"; };
-template <> struct unit<std::micro> { static constexpr char value[] = "us"; };
-template <> struct unit<std::nano> { static constexpr char value[] = "ns"; };
+template <> struct unit<std::ratio<3600>> { static const char value[]; };
+template <> struct unit<std::ratio<60>> { static const char value[]; };
+template <> struct unit<std::ratio<1>> { static const char value[]; };
+template <> struct unit<std::milli> { static const char value[]; };
+template <> struct unit<std::micro> { static const char value[]; };
+template <> struct unit<std::nano> { static const char value[]; };
 } // namespace detail
 
 template <typename Rep, typename Period>

Modified: llvm/trunk/lib/Support/Chrono.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Chrono.cpp?rev=294327&r1=294326&r2=294327&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Chrono.cpp (original)
+++ llvm/trunk/lib/Support/Chrono.cpp Tue Feb  7 12:35:36 2017
@@ -16,12 +16,12 @@ namespace llvm {
 
 using namespace sys;
 
-constexpr char detail::unit<std::ratio<3600>>::value[];
-constexpr char detail::unit<std::ratio<60>>::value[];
-constexpr char detail::unit<std::ratio<1>>::value[];
-constexpr char detail::unit<std::milli>::value[];
-constexpr char detail::unit<std::micro>::value[];
-constexpr char detail::unit<std::nano>::value[];
+const char detail::unit<std::ratio<3600>>::value[] = "h";
+const char detail::unit<std::ratio<60>>::value[] = "m";
+const char detail::unit<std::ratio<1>>::value[] = "s";
+const char detail::unit<std::milli>::value[] = "ms";
+const char detail::unit<std::micro>::value[] = "us";
+const char detail::unit<std::nano>::value[] = "ns";
 
 static inline struct tm getStructTM(TimePoint<> TP) {
   struct tm Storage;




More information about the llvm-commits mailing list