Boost logo

Boost :

Subject: Re: [boost] [core] Breaking bugfix in scoped enums
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-06-06 19:04:28

Le 07/06/14 00:41, Andrey Semashev a écrit :
> Hi,
> While creating tests for scoped enums emulation I've fixed a bug which

Thnaks for fixing this

    typename EnumType::enum_type native_value(EnumType e)


- return e.native_value_();

+ return e.get_native_value_();


> resulted in the enums being convertible to int. This is a potentially breaking
> change, the code like this will now not compile:
> {
> red, green, blue
> }
> void foo(boost::native_type<color>::type col);
> color col = color::blue;
> foo(col);
> The call to foo() should be done like this:
> foo(boost::native_value(col));
> Previously, the conversion was implicit.
Yes, this is a breaking change. The implicit conversion from EnumType to
enum_type was intentional.

operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); }

I was expecting two implicit conversions: one from EnumType to enum_type
and the other from enum_type to int. Am I missing something in C++98?


Boost list run by bdawes at, gregod at, cpdaniel at, john at