From: Eli Friedman Date: Wed, 29 Apr 2009 16:35:53 +0000 (+0000) Subject: PR4103: Silence bogus unused expression warning. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=852871abbff45f1c1d3787755a27fce08365b166;p=clang PR4103: Silence bogus unused expression warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70384 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index acf119ab79..d89290bbb9 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -500,7 +500,8 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1, return true; case CallExprClass: - case CXXOperatorCallExprClass: { + case CXXOperatorCallExprClass: + case CXXMemberCallExprClass: { // If this is a direct call, get the callee. const CallExpr *CE = cast(this); const Expr *CalleeExpr = CE->getCallee()->IgnoreParenCasts(); diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp new file mode 100644 index 0000000000..55f959de0f --- /dev/null +++ b/test/SemaCXX/unused.cpp @@ -0,0 +1,15 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// PR4103 : Make sure we don't get a bogus unused expression warning +class APInt { + char foo; +}; +class APSInt : public APInt { + char bar; +public: + APSInt &operator=(const APSInt &RHS); +}; + +APSInt& APSInt::operator=(const APSInt &RHS) { + APInt::operator=(RHS); + return *this; +}