PR libstdc++/24975 (basic_string)
2005-11-23 Paolo Carlini <pcarlini@suse.de> PR libstdc++/24975 (basic_string) * include/bits/basic_string.h (_Rep::_S_empty_rep): Avoid strict-aliasing warnings. From-SVN: r107447
This commit is contained in:
parent
89de9021fb
commit
7fdc03073c
|
@ -1,3 +1,9 @@
|
||||||
|
2005-11-23 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
PR libstdc++/24975 (basic_string)
|
||||||
|
* include/bits/basic_string.h (_Rep::_S_empty_rep): Avoid
|
||||||
|
strict-aliasing warnings.
|
||||||
|
|
||||||
2005-11-22 Paolo Carlini <pcarlini@suse.de>
|
2005-11-22 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
PR libstdc++/24975
|
PR libstdc++/24975
|
||||||
|
|
|
@ -177,7 +177,13 @@ namespace std
|
||||||
|
|
||||||
static _Rep&
|
static _Rep&
|
||||||
_S_empty_rep()
|
_S_empty_rep()
|
||||||
{ return *reinterpret_cast<_Rep*>(&_S_empty_rep_storage); }
|
{
|
||||||
|
// NB: Mild hack to avoid strict-aliasing warnings. Note that
|
||||||
|
// _S_empty_rep_storage is never modified and the punning should
|
||||||
|
// be reasonably safe in this case.
|
||||||
|
void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
|
||||||
|
return *reinterpret_cast<_Rep*>(__p);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
_M_is_leaked() const
|
_M_is_leaked() const
|
||||||
|
|
Loading…
Reference in New Issue