
7 Apr
2013
7 Apr
'13
12:22 p.m.
AMDG On 04/07/2013 08:40 AM, Aleksandar Fabijanic wrote:
Looking at the type_erasure example:
typedef any<boost::mpl::vector<copy_constructible<>, typeid_<>, addable<>>
any_type;
any_type x(1.1); any_type y(1); any_type z(x + y);
Apparently, without placeholders for x and y, this is undefined behavior. Am I interpreting it right? If so, shouldn't it fail to compile or at least throw an exception at runtime?
It's impossible to make this fail to compile. Undefined behavior does not mean throw an exception; it means all bets are off. If you add relaxed to the concept, then you'll get an exception. In Christ, Steven Watanabe