diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -78,7 +78,7 @@
 
     // Constexpr version of std::strlen.
     static constexpr size_t strLen(const char *Str) {
-#if __cplusplus > 201402L
+#if __cplusplus > 201402L && !defined(_MSC_VER)
       return std::char_traits<char>::length(Str);
 #elif __has_builtin(__builtin_strlen) || defined(__GNUC__) || \
     (defined(_MSC_VER) && _MSC_VER >= 1916)