aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/Expr.cpp1
-rw-r--r--test/SemaCXX/unused.cpp12
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 74308a0093..30342585c8 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -2019,6 +2019,7 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
R1 = getSourceRange();
return true;
}
+ case CXXFunctionalCastExprClass:
case CStyleCastExprClass: {
// Ignore an explicit cast to void unless the operand is a non-trivial
// volatile lvalue.
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp
index 54898c828e..b9877a1ba4 100644
--- a/test/SemaCXX/unused.cpp
+++ b/test/SemaCXX/unused.cpp
@@ -34,3 +34,15 @@ namespace derefvolatile {
(void)y; // don't warn here, because it's a common pattern.
}
}
+
+// <rdar://problem/12359208>
+namespace AnonObject {
+ struct Foo {
+ Foo(const char* const message);
+ ~Foo();
+ };
+ void f() {
+ Foo("Hello World!"); // don't warn
+ int(1); // expected-warning {{expression result unused}}
+ }
+}