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]

Re: -Wextra and enumerator/non-enumerator in conditional expressions


Ching, Jimen (US SSA) wrote:
According to the manual, I should be getting a warning, but I don't.
Did
I misunderstand the manual?

A conditional expression, as per the ISO C/C++ standards, is an expression of the form (A ? B : C). There is no conditional expression in your testcase.


Also, in order to see the warning, you have to use a type that the enum does not easily convert to. Something like
return (1 ? BAR : 1L);
works.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com



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