diff options
author | Reid Kleckner <rnk@google.com> | 2016-10-11 23:02:21 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-10-11 23:02:21 +0000 |
commit | 038febb3e40a3bcfdaad2a9c1c040a3140fc6a4b (patch) | |
tree | c8a36bf223859d85bcf01e1f0d0fd952400b2f9a | |
parent | 7adbf6b04224425d5db863bb80c7b295cf15c9aa (diff) | |
download | bcm5719-llvm-038febb3e40a3bcfdaad2a9c1c040a3140fc6a4b.tar.gz bcm5719-llvm-038febb3e40a3bcfdaad2a9c1c040a3140fc6a4b.zip |
Fix the stage2 MSVC 2013 build with less constexpr in RNG
llvm-svn: 283954
-rw-r--r-- | llvm/include/llvm/Support/RandomNumberGenerator.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h index 1a1e2fd010c..b3046e1e268 100644 --- a/llvm/include/llvm/Support/RandomNumberGenerator.h +++ b/llvm/include/llvm/Support/RandomNumberGenerator.h @@ -43,8 +43,19 @@ public: /// Returns a random number in the range [0, Max). result_type operator()(); - static LLVM_CONSTEXPR result_type min() { return generator_type::min(); } - static LLVM_CONSTEXPR result_type max() { return generator_type::max(); } + + // We can only make min/max constexpr if generator_type::min/max are + // constexpr. The MSVC 2013 STL does not make these constexpr, so we have to + // avoid declaring them as constexpr even if the compiler, like clang-cl, + // supports it. +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define STL_CONSTEXPR +#else +#define STL_CONSTEXPR LLVM_CONSTEXPR +#endif + + static STL_CONSTEXPR result_type min() { return generator_type::min(); } + static STL_CONSTEXPR result_type max() { return generator_type::max(); } private: /// Seeds and salts the underlying RNG engine. |