This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/67996] std::ios_base::seekdir raises -Wswitch with Clang
- From: "kim.grasman at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 17 Oct 2015 05:57:56 +0000
- Subject: [Bug libstdc++/67996] std::ios_base::seekdir raises -Wswitch with Clang
- Auto-submitted: auto-generated
- References: <bug-67996-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67996
--- Comment #2 from Kim GrÃsman <kim.grasman at gmail dot com> ---
Thanks, I figured that was why.
The warning is not a problem if I'm using <ios> directly, then I can just
disable it locally.
But we ran into this with a third-party library having the code above in one of
their headers. This makes it nigh-impossible for us to enable -Wswitch for our
own code, as the third-party header could be indirectly included in any
translation unit.
ios:
enum seekdir { beg, cur, end, _S_ios_seekdir_end };
third-party.h:
switch(seekdir) {
case beg: break;
case cur: break;
case end: break;
}
us.cpp:
#include "third-party.h" // WARN
I wasn't sure if the extra enumerator was allowed by the standard, so thanks
for confirming that.
We've now worked around it by patching the third-party to use an if/else chain
instead, but I thought I'd raise it anyway because it creates a messy situation
when the warning "leaks" like this.