[Bug c++/51312] [C++0x] Wrong interpretation of converted constant expressions (for enumerator initializers)

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Sun Apr 29 14:12:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51312

--- Comment #5 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-29 14:12:12 UTC ---
Created attachment 27261
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27261
build_enumerator patch

Changes the behavior on g++.dg/cpp0x/enum_base.C from an error to a warning in
the first 2 cases. And reusing the narrowing warning message may look a bit
strange.

enum E4 : char { 
  val = 500 // { dg-error "too large" }
};

enum_base.C:9:9: warning: narrowing conversion of '500' from 'int' to 'char'
inside { } [-Wnarrowing]
   val = 500 // { dg-error "too large" }
         ^
enum_base.C:9:9: warning: overflow in implicit constant conversion [-Woverflow]
   val = 500 // { dg-error "too large" }
         ^



More information about the Gcc-bugs mailing list