mirror of
https://github.com/boostorg/container.git
synced 2025-08-03 14:34:27 +02:00
Fixes Trac #12183 (GCC 6.1 thinks boost::container::string violates strict aliasing)
This commit is contained in:
@@ -1218,10 +1218,10 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
* Fixed bugs:
|
* Fixed bugs:
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/11170 Trac #11170: ['"Doc slip for index_of"]].
|
* [@https://svn.boost.org/trac/boost/ticket/11170 Trac #11170: ['"Doc slip for index_of"]].
|
||||||
* [@https://svn.boost.org/trac/boost/ticket/12177 Trac #12177: ['"vector::priv_merge uses unqualified uintptr_t"]].
|
* [@https://svn.boost.org/trac/boost/ticket/12177 Trac #12177: ['"vector::priv_merge uses unqualified uintptr_t"]].
|
||||||
|
* [@https://svn.boost.org/trac/boost/ticket/12183 Trac #12183: ['"GCC 6.1 thinks boost::container::string violates strict aliasing"]].
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
|
||||||
[section:release_notes_boost_1_61_00 Boost 1.61 Release]
|
[section:release_notes_boost_1_61_00 Boost 1.61 Release]
|
||||||
|
|
||||||
* [classref boost::container::small_vector] supports more constructors and assignments.
|
* [classref boost::container::small_vector] supports more constructors and assignments.
|
||||||
|
@@ -230,7 +230,13 @@ class basic_string_base
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool is_short() const
|
bool is_short() const
|
||||||
{ return static_cast<bool>(this->members_.m_repr.s.h.is_short != 0); }
|
{
|
||||||
|
//Access and copy (to avoid UB) the first byte of the union to know if the
|
||||||
|
//active representation is short or long
|
||||||
|
short_header hdr;
|
||||||
|
*(unsigned char*)&hdr = *(unsigned char*)&this->members_.m_repr;
|
||||||
|
return hdr.is_short != 0;
|
||||||
|
}
|
||||||
|
|
||||||
void is_short(bool yes)
|
void is_short(bool yes)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user