----- Forwarded message from [EMAIL PROTECTED] -----
    Date: Thu, 26 Apr 2007 00:37:14 -0700 (PDT)
    From: Gennaro Prota <[EMAIL PROTECTED]>
Reply-To: Gennaro Prota <[EMAIL PROTECTED]>
 Subject: Enums and gcc's long long
      To: Gabriel Dos Reis <[EMAIL PROTECTED]>

Hi Gabriel and sorry if this is sort of spam. I should have posted
this to the relevant list but I have some news server problems.
Perhaps you can forward it? (Perhaps it's already in Bugzilla, or it
isn't a bug at all)

  // compiled with gcc version 3.4.2 (mingw-special)
  // g++ -Wall -ansi  -pedantic-error EnumSign.cpp
  //
  #include <ostream>
  #include <iostream>

  enum E { a = -1, x = 0xFFFFFFFF };

  void f( signed )
  {
        std::cout << "signed" << std::endl;
  }

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

  int main()
  {
    E e;
    f( e );
  }



Output:
$ g++ -Wall -ansi  -pedantic-error EnumSign.cpp
EnumSign.cpp: In function `int main()':
EnumSign.cpp:19: error: call of overloaded `f(E&)' is ambiguous
EnumSign.cpp:7: note: candidates are: void f(int)
EnumSign.cpp:12: note:                 void f(unsigned int)

Given that I used -pedantic-error, the compiler shouldn't use long
long as underlying type of the enum (as it seems to do) and flag the
enumerator declaration as ill-formed. Am I missing anything?

Thanks.

-- 
Gennaro Prota
https://sourceforge.net/projects/breeze/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


----- End forwarded message -----

Reply via email to