https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61421
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2014-06-05 Ever confirmed|0 |1 --- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to mimamer from comment #9) > Now that I have read enough about aliasing rules I realize that they are > considerably fucked up and that their is no way to efficiently downcast > without violating strict aliasing rules. I don't see any downcasting, all I see is side casting; at least with your code sections so far. How are list2<T>::node and T declared? Does the first element of node a T or inherits from T? If not there is no downcasting, it is rather side casting and that is what makes the code undefined.