Boost logo

Boost :

Subject: Re: [boost] [core] Breaking bugfix in scoped enums
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-06-07 05:37:07


On Saturday 07 June 2014 11:02:12 Vicente J. Botet Escriba wrote:
>
> Thanks Peter I don't know to what I was thinking :(
> An enum (scoped or not) is always implicitly convertible to its
> underlying type.

Scoped enums must not implicitly convert to integers, be that underlying type
or not. See 7.2/9 [dcl.enum].

> Andrey, why this implicit conversion must be removed? What is wrong with it?
>
> - operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); }
>
> I have added the line you removed and all the test pass. Which case need
> to remove this implicit conversion?

As I said, scoped_enum_compile_fail_conv_to_int.cpp test fails (i.e. it
compiles while it shouldn't).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk