This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Enums and gcc's long long



----- Forwarded message from gennaro.prota@yahoo.com -----
    Date: Thu, 26 Apr 2007 00:37:14 -0700 (PDT)
    From: Gennaro Prota <gennaro.prota@yahoo.com>
Reply-To: Gennaro Prota <gennaro.prota@yahoo.com>
 Subject: Enums and gcc's long long
      To: Gabriel Dos Reis <gdr@cs.tamu.edu>

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 -----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]