使用Boost 1.43和GCC 4.4.3,代码如下
boost::bind(&SomeObject::memberFunc, this, _1));
生成以下警告
boost/function/function_base.hpp:321: warning: dereferencing type-punned pointer will break strict-aliasing rules
在不设置 -fno-strict-aliasing 的情况下消除这些警告的正确方法是什么?
最佳答案
只是为了记录,我对使用 GCC 4.4.3 的 boost::bind for Google's Native Client 发出了相同的警告。将 boost 从 1.41.0 版本升级到 1.47.0 后警告消失。
关于c++ - boost::bind 打破了严格的别名规则?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3042146/