[PATCH] D43110: [Sema] Don't mark plain MS enums as fixed
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 8 18:22:20 PST 2018
rnk created this revision.
rnk added a reviewer: rsmith.
This fixes a flaw in our AST: PR27098
MSVC always gives plain enums the underlying type 'int'. Clang does this
as well, but we claim the enum is "fixed", as if the user actually wrote
': int'. It means we end up emitting spurious -Wsign-compare warnings on
code like this:
enum Vals { E1, E2, E3 };
bool f(unsigned v1, Vals v2) {
return v1 == v2;
}
We think 'v2' can take on negative values because we think 'Vals' is
fixed. This fixes that.
https://reviews.llvm.org/D43110
Files:
clang/include/clang/AST/Decl.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Type.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43110.133553.patch
Type: text/x-patch
Size: 7868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180209/f2277b80/attachment.bin>
More information about the cfe-commits
mailing list