summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-02-12 17:37:06 +0000
committerReid Kleckner <rnk@google.com>2018-02-12 17:37:06 +0000
commitb0a17edff7f8873a33e304077b7528e2ed09e36b (patch)
tree07b793cd34e7a2822b708f55cc88ac5db88bc4bc /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parente72d99261f0765a42779497f4e2100a4e40b95ab (diff)
downloadbcm5719-llvm-b0a17edff7f8873a33e304077b7528e2ed09e36b.tar.gz
bcm5719-llvm-b0a17edff7f8873a33e304077b7528e2ed09e36b.zip
[Sema] Don't mark plain MS enums as fixed
Summary: 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. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D43110 llvm-svn: 324913
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 15b53ca7612..1ccd0c84c42 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1041,8 +1041,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) {
SemaRef.SubstType(TI->getType(), TemplateArgs,
UnderlyingLoc, DeclarationName());
SemaRef.CheckEnumRedeclaration(Def->getLocation(), Def->isScoped(),
- DefnUnderlying,
- /*EnumUnderlyingIsImplicit=*/false, Enum);
+ DefnUnderlying, /*IsFixed=*/true, Enum);
}
}
OpenPOWER on IntegriCloud