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

--- Comment #7 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> A better example:
> 
> typedef unsigned char foo;
> 
> enum class myenum
> {
>   foo,
>   bar = (foo)-1
> };
> 
> Is the value -1L or 255?
> 
> If I rename myenum::foo to myenum::Foo the code silently changes meaning.

That is a very good example indeed and I don't really know the answer. In an
ideal world we would only warn when ambiguity exists (in the user mind), that
is, at "bar = (foo) -1". However, that is probably much more difficult and
expensive than the current warning. So I don't think this is a bug but perhaps
we should add this example to http://gcc.gnu.org/wiki/VerboseDiagnostics

Reply via email to