https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82307

            Bug ID: 82307
           Summary: unscoped enum-base incorrect cast
           Product: gcc
           Version: 6.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pro100fifa at ukr dot net
  Target Milestone: ---

Created attachment 42228
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42228&action=edit
The code have a bug

Hello to GCC ( g++ ) developers!
My English is bad, but i hope you will understand me.

I found a bug ( if it is ) in g++ 6.4.0 version ( and earlier ).
I will just provide a code which have the bug:

/* Begin */
#include <iostream>

enum : unsigned long long { VAL };


void foo( unsigned long long )
{
    std::cout << "unsigned long long" << std::endl;
}

void foo( int )
{
    std::cout << "int" << std::endl;
}


int main( void )
{
    foo( VAL );
}
/* End */

I compiled this code in a Unix-like environment and command-line interface for
Microsoft Windows -- Cygwin ( 64-bit ). I used following compiler options:
-Wall -Wextra -std=c++17 <path_to_file.cpp>

The following error messages were displayed:
C:\Users\Maxim\Desktop\test.cpp: In function ‘int main()’:
C:\Users\Maxim\Desktop\test.cpp:19:14: error: call of overloaded
‘foo(<anonymous enum>)’ is ambiguous
     foo( VAL );
              ^
C:\Users\Maxim\Desktop\test.cpp:6:6: note: candidate: void foo(long long
unsigned int)
 void foo( unsigned long long )
      ^~~
C:\Users\Maxim\Desktop\test.cpp:11:6: note: candidate: void foo(int)
 void foo( int )
      ^~~

----
Thank you.

Reply via email to