Hi,
I bumped into an issue, where g++ would give me an anti-aliasing warning
for very basic / straightforward signals2 code. consider the following
sample code:
#include <iostream>
#include
#include
typedef boost::signals2::signal sig_t;
void ff(void) {
std::cout << "ff" << std::endl;
}
int main(void) {
sig_t::slot_type ss = boost::bind(&ff);
return 0;
}
when compiled with the -Wall and -O2 flags, I get the following compiler
warning:
...
sample.cxx:13: instantiated from here
/home/maroy/src/mxp/usr/include/boost/function/function_base.hpp:321:
warning: dereferencing type-punned pointer will break strict-aliasing rules
/home/maroy/src/mxp/usr/include/boost/function/function_base.hpp:325:
warning: dereferencing type-punned pointer will break strict-aliasing rules
(I can provide the full compiler output if needed)
this is with boost 1.44 on a linux x86_64, g++ version 4.4.3
omitting either the -O2 or the -Wall flags will make the warning go away.
what am I doing wrong?
Akos