From 6997bd24267a03565391f9ed9f3c9ab9f235fd86 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 7 Feb 2017 18:35:36 +0000 Subject: [PATCH] Attempt to fix MSVC build broken by r294326 MSVC does not think that `char []` can be constexpr. Switch to regular const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294327 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Chrono.h | 22 ++++++++-------------- lib/Support/Chrono.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/llvm/Support/Chrono.h b/include/llvm/Support/Chrono.h index c46ae5a32db..6118ed0476e 100644 --- a/include/llvm/Support/Chrono.h +++ b/include/llvm/Support/Chrono.h @@ -76,21 +76,15 @@ raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); /// display unit or you request that the unit is not displayed. namespace detail { -template struct unit { static constexpr char value[] = ""; }; -template constexpr char unit::value[]; +template struct unit { static const char value[]; }; +template const char unit::value[] = ""; -template <> struct unit> { - static constexpr char value[] = "h"; -}; - -template <> struct unit> { - static constexpr char value[] = "m"; -}; - -template <> struct unit> { static constexpr char value[] = "s"; }; -template <> struct unit { static constexpr char value[] = "ms"; }; -template <> struct unit { static constexpr char value[] = "us"; }; -template <> struct unit { static constexpr char value[] = "ns"; }; +template <> struct unit> { static const char value[]; }; +template <> struct unit> { static const char value[]; }; +template <> struct unit> { static const char value[]; }; +template <> struct unit { static const char value[]; }; +template <> struct unit { static const char value[]; }; +template <> struct unit { static const char value[]; }; } // namespace detail template diff --git a/lib/Support/Chrono.cpp b/lib/Support/Chrono.cpp index ef81edc9269..ca748f5c046 100644 --- a/lib/Support/Chrono.cpp +++ b/lib/Support/Chrono.cpp @@ -16,12 +16,12 @@ namespace llvm { using namespace sys; -constexpr char detail::unit>::value[]; -constexpr char detail::unit>::value[]; -constexpr char detail::unit>::value[]; -constexpr char detail::unit::value[]; -constexpr char detail::unit::value[]; -constexpr char detail::unit::value[]; +const char detail::unit>::value[] = "h"; +const char detail::unit>::value[] = "m"; +const char detail::unit>::value[] = "s"; +const char detail::unit::value[] = "ms"; +const char detail::unit::value[] = "us"; +const char detail::unit::value[] = "ns"; static inline struct tm getStructTM(TimePoint<> TP) { struct tm Storage;