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
+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>
PR libstdc++/24975
static _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
_M_is_leaked() const