mirror of
https://github.com/boostorg/static_string.git
synced 2026-01-19 04:42:12 +00:00
Work around GCC 9 rejecting a legitimate pointer comparison in a constexpr context
This commit is contained in:
committed by
Gennaro Prota
parent
4dcfb39494
commit
0e28b358dc
@@ -286,4 +286,11 @@ using basic_string_view =
|
||||
#define BOOST_STATIC_STRING_GCC_NESTED_CLASS_WORKAROUND
|
||||
#endif
|
||||
|
||||
// GCC 9 incorrectly rejects the pointer equality comparison in
|
||||
// ptr_in_range() in constant expressions. GCC 10 and later handle
|
||||
// it correctly.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && (__GNUC__ == 9)
|
||||
#define BOOST_STATIC_STRING_CONSTEXPR_PTR_CMP_BROKEN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -255,7 +255,8 @@ testConstantEvaluation()
|
||||
a.replace(a.begin(), a.end(), a.begin(), a.end());
|
||||
a.replace(a.begin(), a.end(), {'a'});
|
||||
|
||||
#ifdef BOOST_STATIC_STRING_IS_CONST_EVAL
|
||||
#if defined(BOOST_STATIC_STRING_IS_CONST_EVAL) \
|
||||
&& !defined(BOOST_STATIC_STRING_CONSTEXPR_PTR_CMP_BROKEN)
|
||||
a.clear();
|
||||
a.replace(a.begin(), a.end(), "a");
|
||||
a.replace(a.begin(), a.end(), "a", 1);
|
||||
@@ -443,7 +444,8 @@ testConstantEvaluation()
|
||||
a.replace(a.begin(), a.end(), a.begin(), a.end());
|
||||
a.replace(a.begin(), a.end(), {'a'});
|
||||
|
||||
#ifdef BOOST_STATIC_STRING_IS_CONST_EVAL
|
||||
#if defined(BOOST_STATIC_STRING_IS_CONST_EVAL) \
|
||||
&& !defined(BOOST_STATIC_STRING_CONSTEXPR_PTR_CMP_BROKEN)
|
||||
a.clear();
|
||||
a.replace(a.begin(), a.end(), "a");
|
||||
a.replace(a.begin(), a.end(), "a", 1);
|
||||
|
||||
Reference in New Issue
Block a user