Commit 07522ae9 by Jonathan Wakely

libstdc++: Fix compilation with released versions of Clang

Clang 9 supports C++20 via -std=c++2a but doesn't support Concepts, so
several of the new additions related to the Ranges library fail to
compile with -std=c++2a. The new definition of iterator_traits and the
definition of default_sentinel_t are guarded by __cpp_lib_concepts, so
check that in addition to __cplusplus > 201703L.

	* include/bits/stl_algobase.h (__lexicographical_compare_aux): Check
	__cpp_lib_concepts before using iter_reference_t.
	* include/bits/stream_iterator.h (istream_iterator): Check
	__cpp_lib_concepts before using default_sentinel_t.
	* include/bits/streambuf_iterator.h (istreambuf_iterator): Likewise.
parent dbde9e2d
2020-03-18 Jonathan Wakely <jwakely@redhat.com> 2020-03-18 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_algobase.h (__lexicographical_compare_aux): Check
__cpp_lib_concepts before using iter_reference_t.
* include/bits/stream_iterator.h (istream_iterator): Check
__cpp_lib_concepts before using default_sentinel_t.
* include/bits/streambuf_iterator.h (istreambuf_iterator): Likewise.
PR libstdc++/94203 PR libstdc++/94203
* include/experimental/executor (executor::executor(Executor)): Call * include/experimental/executor (executor::executor(Executor)): Call
make_shared directly instead of _M_create. Create _Tgt1 object. make_shared directly instead of _M_create. Create _Tgt1 object.
......
...@@ -1283,7 +1283,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER ...@@ -1283,7 +1283,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
&& !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed
&& __is_pointer<_II1>::__value && __is_pointer<_II1>::__value
&& __is_pointer<_II2>::__value && __is_pointer<_II2>::__value
#if __cplusplus > 201703L #if __cplusplus > 201703L && __cpp_lib_concepts
// For C++20 iterator_traits<volatile T*>::value_type is non-volatile // For C++20 iterator_traits<volatile T*>::value_type is non-volatile
// so __is_byte<T> could be true, but we can't use memcmp with // so __is_byte<T> could be true, but we can't use memcmp with
// volatile data. // volatile data.
......
...@@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -77,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_ok(__obj._M_ok) _M_ok(__obj._M_ok)
{ } { }
#if __cplusplus > 201703L #if __cplusplus > 201703L && __cpp_lib_concepts
constexpr constexpr
istream_iterator(default_sentinel_t) istream_iterator(default_sentinel_t)
noexcept(is_nothrow_default_constructible_v<_Tp>) noexcept(is_nothrow_default_constructible_v<_Tp>)
...@@ -153,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -153,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator!=(const istream_iterator& __x, const istream_iterator& __y) operator!=(const istream_iterator& __x, const istream_iterator& __y)
{ return !__x._M_equal(__y); } { return !__x._M_equal(__y); }
#if __cplusplus > 201703L #if __cplusplus > 201703L && __cpp_lib_concepts
friend bool friend bool
operator==(const istream_iterator& __i, default_sentinel_t) operator==(const istream_iterator& __i, default_sentinel_t)
{ return !__i._M_stream; } { return !__i._M_stream; }
......
...@@ -115,7 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -115,7 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT _GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT
: _M_sbuf(0), _M_c(traits_type::eof()) { } : _M_sbuf(0), _M_c(traits_type::eof()) { }
#if __cplusplus > 201703L #if __cplusplus > 201703L && __cpp_lib_concepts
constexpr istreambuf_iterator(default_sentinel_t) noexcept constexpr istreambuf_iterator(default_sentinel_t) noexcept
: istreambuf_iterator() { } : istreambuf_iterator() { }
#endif #endif
...@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -215,7 +215,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return traits_type::eq_int_type(__c, __eof); return traits_type::eq_int_type(__c, __eof);
} }
#if __cplusplus > 201703L #if __cplusplus > 201703L && __cpp_lib_concepts
friend bool friend bool
operator==(const istreambuf_iterator& __i, default_sentinel_t __s) operator==(const istreambuf_iterator& __i, default_sentinel_t __s)
{ return __i._M_at_eof(); } { return __i._M_at_eof(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment