PR libstdc++/88840 delay evaluation of constant until type is complete
Clang fails to compile std::vector<Incomplete> because the static member __use_relocate cannot be evaluated for an incomplete type. Replace with a static member function that will not be odr-used until needed, by which point the type must be complete. PR libstdc++/88840 * include/bits/stl_vector.h (vector::__use_relocate): Replace static data member with static member function _S_use_relocate(). * include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert) (vector::_M_default_append): Use _S_use_relocate() instead of __use_relocate. From-SVN: r268239
This commit is contained in:
parent
400a08e284
commit
e658669fe1
@ -1,5 +1,12 @@
|
|||||||
2019-01-24 Jonathan Wakely <jwakely@redhat.com>
|
2019-01-24 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/88840
|
||||||
|
* include/bits/stl_vector.h (vector::__use_relocate): Replace static
|
||||||
|
data member with static member function _S_use_relocate().
|
||||||
|
* include/bits/vector.tcc (vector::reserve, vector::_M_realloc_insert)
|
||||||
|
(vector::_M_default_append): Use _S_use_relocate() instead of
|
||||||
|
__use_relocate.
|
||||||
|
|
||||||
* testsuite/27_io/filesystem/path/compare/strings.cc: Only compare
|
* testsuite/27_io/filesystem/path/compare/strings.cc: Only compare
|
||||||
sign of results.
|
sign of results.
|
||||||
|
|
||||||
|
@ -424,11 +424,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
static constexpr bool __use_relocate =
|
static constexpr bool
|
||||||
noexcept(std::__relocate_a(std::declval<pointer>(),
|
_S_use_relocate()
|
||||||
std::declval<pointer>(),
|
{
|
||||||
std::declval<pointer>(),
|
return noexcept(std::__relocate_a(std::declval<pointer>(),
|
||||||
std::declval<_Tp_alloc_type&>()));
|
std::declval<pointer>(),
|
||||||
|
std::declval<pointer>(),
|
||||||
|
std::declval<_Tp_alloc_type&>()));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -73,7 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||||||
const size_type __old_size = size();
|
const size_type __old_size = size();
|
||||||
pointer __tmp;
|
pointer __tmp;
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
if constexpr (__use_relocate)
|
if constexpr (_S_use_relocate())
|
||||||
{
|
{
|
||||||
__tmp = this->_M_allocate(__n);
|
__tmp = this->_M_allocate(__n);
|
||||||
std::__relocate_a(this->_M_impl._M_start,
|
std::__relocate_a(this->_M_impl._M_start,
|
||||||
@ -457,7 +457,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||||||
__new_finish = pointer();
|
__new_finish = pointer();
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
if constexpr (__use_relocate)
|
if constexpr (_S_use_relocate())
|
||||||
{
|
{
|
||||||
__new_finish
|
__new_finish
|
||||||
= std::__relocate_a
|
= std::__relocate_a
|
||||||
@ -498,7 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
if constexpr (!__use_relocate)
|
if constexpr (!_S_use_relocate())
|
||||||
#endif
|
#endif
|
||||||
std::_Destroy(__old_start, __old_finish, _M_get_Tp_allocator());
|
std::_Destroy(__old_start, __old_finish, _M_get_Tp_allocator());
|
||||||
_GLIBCXX_ASAN_ANNOTATE_REINIT;
|
_GLIBCXX_ASAN_ANNOTATE_REINIT;
|
||||||
@ -639,7 +639,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||||||
_M_check_len(__n, "vector::_M_default_append");
|
_M_check_len(__n, "vector::_M_default_append");
|
||||||
pointer __new_start(this->_M_allocate(__len));
|
pointer __new_start(this->_M_allocate(__len));
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
if constexpr (__use_relocate)
|
if constexpr (_S_use_relocate())
|
||||||
{
|
{
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user