0

I am trying to set more than one value to an enum variable, but I am currently facing a compilation error:

main()
{
    typedef enum t_e {
        T_FIRST = 0x00,
        T_SECOND = 0x01,
        T_THIRD = 0x02,
    } t_t;

    t_t value = T_SECOND;
    value |= T_THIRD;
}
error: invalid conversion from ‘int’ to ‘t_t {aka main()::t_e}’ [-fpermissive]
     value |= T_THIRD;

Could you please help? Is there any way I can achieve it?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
getinfo
  • 9
  • 2

0 Answers0