aboutsummaryrefslogtreecommitdiff
path: root/absl/strings/internal/string_constant.h
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2022-06-09 07:49:38 -0700
committerCopybara-Service <copybara-worker@google.com>2022-06-09 07:50:21 -0700
commit9eff97861b88999428d1254f95c83d94a2e95944 (patch)
treec7e8da7cd859195888b7c3349c5b02d157758ed3 /absl/strings/internal/string_constant.h
parent7383f346c9e33a08ed2132f117b3de6b13eac173 (diff)
downloadabseil-9eff97861b88999428d1254f95c83d94a2e95944.tar.gz
abseil-9eff97861b88999428d1254f95c83d94a2e95944.tar.bz2
abseil-9eff97861b88999428d1254f95c83d94a2e95944.zip
Fix C++17 constexpr storage deprecation warnings
This change introduces the symbol ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL to guard redundant declarations of static constexpr data members that are needed prior to C++17. This change also introduces the symbol ABSL_INTERNAL_CPLUSPLUS_LANG, which is supposed to be set to the same value as __cplusplus, except it uses _MSVC_LANG on MSVC so that the value is correct on MSVC. Neither of these new symbols should be used outside of Abseil. Fixes #1191 PiperOrigin-RevId: 453923908 Change-Id: I1316c52c19fa0c168b93cced0c817e4cb7c9c862
Diffstat (limited to 'absl/strings/internal/string_constant.h')
-rw-r--r--absl/strings/internal/string_constant.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/absl/strings/internal/string_constant.h b/absl/strings/internal/string_constant.h
index b358efdd..f68b17d7 100644
--- a/absl/strings/internal/string_constant.h
+++ b/absl/strings/internal/string_constant.h
@@ -50,8 +50,10 @@ struct StringConstant {
"The input string_view must point to constant data.");
};
+#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
template <typename T>
-constexpr absl::string_view StringConstant<T>::value; // NOLINT
+constexpr absl::string_view StringConstant<T>::value;
+#endif
// Factory function for `StringConstant` instances.
// It supports callables that have a constexpr default constructor and a