Re: Prohibit enum <-> int mixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 January 2011 20:11, Enrico Weigelt wrote:
> * Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
>
>> Technically what is allowed is implicit conversion from enum to int.
>> In C++0x you can define a scoped enum which doesn't allow the
>> conversion.
>
> How exactly is this done ?

enum class foo { bar };

foo f = foo::bar;

int i = foo::bar;  // error, no conversion


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux