about summary refs log tree commit diff
path: root/absl/strings
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings')
-rw-r--r--absl/strings/string_view_test.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/absl/strings/string_view_test.cc b/absl/strings/string_view_test.cc
index b4ed8a74603c..4f531226dfe2 100644
--- a/absl/strings/string_view_test.cc
+++ b/absl/strings/string_view_test.cc
@@ -822,15 +822,17 @@ TEST(StringViewTest, FrontBackSingleChar) {
 // "read of dereferenced null pointer is not allowed in a constant expression".
 // At run time, the behavior of `std::char_traits::length()` on `nullptr` is
 // undefined by the standard and usually results in crash with libc++.
+// GCC also started rejected this in libstdc++ starting in GCC9.
 // In MSVC, creating a constexpr string_view from nullptr also triggers an
 // "unevaluable pointer value" error. This compiler implementation conforms
 // to the standard, but `absl::string_view` implements a different
 // behavior for historical reasons. We work around tests that construct
 // `string_view` from `nullptr` when using libc++.
-#if !defined(ABSL_HAVE_STD_STRING_VIEW) || \
-    (!defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
+#if !defined(ABSL_HAVE_STD_STRING_VIEW) ||                    \
+    (!(defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 9) && \
+     !defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
 #define ABSL_HAVE_STRING_VIEW_FROM_NULLPTR 1
-#endif  // !defined(ABSL_HAVE_STD_STRING_VIEW) || !defined(_LIBCPP_VERSION)
+#endif
 
 TEST(StringViewTest, NULLInput) {
   absl::string_view s;