Martin Liška <marxin at gcc dot> changed:

           What    |Removed                     |Added
             Status|ASSIGNED                    |WAITING

--- Comment #1 from Martin Liška <marxin at gcc dot> ---
Confirmed. Note that in GCC 8 we generate a better code:

g++ pr84436.C -O2 -c -S -o/dev/stdout

        movl    %edi, %edi
        movl    CSWTCH.0(,%rdi,4), %eax
        .size   _Z3foo1E, .-_Z3foo1E
        .section        .rodata
        .align 8
        .type   CSWTCH.0, @object
        .size   CSWTCH.0, 12
        .long   0
        .long   1
        .long   2

It's clear that it's optimization opportunity. My question is why you don't
simple do:

   enum class E
        A = 0, B, C,

    int foo(E e)
      return (int)e;

? Is it reduced from a bigger code base?

Reply via email to