summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp3
-rw-r--r--clang/test/SemaObjC/conversion.m17
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 426bf68e1d6..94a58cc625a 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4665,6 +4665,9 @@ static IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
}
}
+ if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(E))
+ return GetExprRange(C, OVE->getSourceExpr(), MaxWidth);
+
if (FieldDecl *BitField = E->getSourceBitField())
return IntRange(BitField->getBitWidthValue(C),
BitField->getType()->isUnsignedIntegerOrEnumerationType());
diff --git a/clang/test/SemaObjC/conversion.m b/clang/test/SemaObjC/conversion.m
new file mode 100644
index 00000000000..88a1a44b217
--- /dev/null
+++ b/clang/test/SemaObjC/conversion.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -Wconversion -fsyntax-only %s -verify
+
+typedef signed char BOOL;
+__attribute__((objc_root_class)) @interface RDar14415662
+@property (readonly) BOOL stuff;
+@property (readwrite) BOOL otherStuff;
+@end
+
+void radar14415662(RDar14415662 *f, char x, int y) {
+ f.otherStuff = !f.stuff; // no-warning
+ BOOL b = !f.stuff; // no-warning
+
+ // True positive to sanity check warning is working.
+ x = y; // expected-warning {{implicit conversion loses integer precision: 'int' to 'char'}}
+}
+
+
OpenPOWER on IntegriCloud