Re: -Wenum-compare and template metaprogramming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2017-05-04 23:33 +0100, Jonathan Wakely wrote:
> On 4 May 2017 at 16:39, Martin Sebor <msebor@xxxxxxxxx> wrote:
> > Assuming the code defines the enums as unnamed types, comparing
> > their enumerators seems unlikely to be a problem.  Or can you
> > think of some accidental misuse that the warning would detect?
> 
> I can't immediately think of any problem, except for encouraging the
> hack, which I'm not fond of :-)

But in C++03 we don't have constexpr and have to use hack...

> > If there isn't one it might to detect the (legacy) idiom and
> > suppress the warning in that case.  Or add a warning suboption
> > to control it, until the code transitions to the more modern
> > way of doing things.  Or perhaps only warn in C++ 11 mode and
> > later.

Maybe we should add something like "-Wenum-hack", and give a hint
to use constexpr for C++11/14/17.
-- 
Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux