diff options
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 1 | ||||
| -rw-r--r-- | clang/test/SemaCXX/unused.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 74308a00939..30342585c8e 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/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/clang/test/SemaCXX/unused.cpp b/clang/test/SemaCXX/unused.cpp index 54898c828ec..b9877a1ba4f 100644 --- a/clang/test/SemaCXX/unused.cpp +++ b/clang/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}} + } +} |

