14 Nov
2013
14 Nov
'13
9:59 p.m.
On 15/11/2013 04:01, Quoth Steven Watanabe:
No, it is not harmless. You cannot safely assume that undefined behavior is ever harmless, just because you can't think of anything that can go wrong. In particular, the compiler is free to make assumptions that can cause your code to miscompile with optimizations on.
Another piece of undefined behaviour is with the RTTI information itself; if you tried to get the typeid/type_id of a type_info with RTTI enabled then you could get unexpected results. I don't know whether this would cause any issues in actual practice (since typeid(typeid(X)) is at least unusual, although not impossible especially once you get templates in the mix).