summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2013-12-05 23:06:53 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2013-12-05 23:06:53 +0000
commite6ac50ad71b7dd63e5b746fce9eb3a1e76debb01 (patch)
treed37767ec45aaa7ae24fc116fdfa335cd0f320408 /clang/lib/Sema/SemaStmt.cpp
parent00fe87b4888b230325edd96a4c2df866d91da64e (diff)
downloadbcm5719-llvm-e6ac50ad71b7dd63e5b746fce9eb3a1e76debb01.tar.gz
bcm5719-llvm-e6ac50ad71b7dd63e5b746fce9eb3a1e76debb01.zip
-Wassign-enum: compare unqualified types
This commit changes -Wassign-enum to compare unqualified types. One could think that this does not matter much, because who wants a value of enum type that is const-qualified? But this breaks the intended pattern to silence this warning with an explicit cast: static const enum Foo z = (enum Foo) 42; In this case, source type is 'enum Foo', and destination type is 'const enum Foo', and if we compare qualified types, they don't match, so we used warn. llvm-svn: 196548
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 077282c1bf1..1d2ebad7881 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1149,7 +1149,7 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
return;
if (const EnumType *ET = DstType->getAs<EnumType>())
- if (!Context.hasSameType(SrcType, DstType) &&
+ if (!Context.hasSameUnqualifiedType(SrcType, DstType) &&
SrcType->isIntegerType()) {
if (!SrcExpr->isTypeDependent() && !SrcExpr->isValueDependent() &&
SrcExpr->isIntegerConstantExpr(Context)) {
@@ -1184,7 +1184,7 @@ Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
EI++;
if (EI == EIend || EI->first != RhsVal) {
Diag(SrcExpr->getExprLoc(), diag::warn_not_in_enum_assignment)
- << DstType;
+ << DstType.getUnqualifiedType();
}
}
}
OpenPOWER on IntegriCloud