Subject: Re: [boost] [TypeIndex] Peer review period for library acceptance begins, ending Thurs 21st Nov
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2013-11-14 16:59:45


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).