Open tomhughes opened 7 years ago
std::variant
gets away without casts because it uses at its core a recursively(!) templated union so that it can write a static accessor that recursively goes through the nested union to access the correct data member by index. Since it uses union
, it doesn't need to cast and can rely on the compiler to perform the correct alignment.
Oops. So that's a regression that came from a fix for an ARM code generation bug I reported with mapnik ;-)
See https://bugzilla.redhat.com/show_bug.cgi?id=1422456 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79671 for the somewhat horrifying/incomprehensible history of the original bug...
@tomhughes 👍
Upstream fix landed and GCC 7.2 just got released: https://gcc.gnu.org/ml/gcc/2017-08/msg00129.html
I was also having this issue with GCC 7.2. I tried to downgrade to gcc6 (using upgrade-alternatives) and I'm somehow still getting this error. Should gcc 6.4 be able to compile this? If not, what version of gcc do I need?
Running
make test
with gcc 7.0.1 fails due to new aliasing warnings, promoted to errors by the-Werror
switch in the makefile: