]> granicus.if.org Git - clang/commitdiff
PR4103: Silence bogus unused expression warning.
authorEli Friedman <eli.friedman@gmail.com>
Wed, 29 Apr 2009 16:35:53 +0000 (16:35 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 29 Apr 2009 16:35:53 +0000 (16:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70384 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp
test/SemaCXX/unused.cpp [new file with mode: 0644]

index acf119ab7974bc584f0855de7fb497700e62bf07..d89290bbb97092a2d87a8cb7efcf011b901b2318 100644 (file)
@@ -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<CallExpr>(this);
     const Expr *CalleeExpr = CE->getCallee()->IgnoreParenCasts();
diff --git a/test/SemaCXX/unused.cpp b/test/SemaCXX/unused.cpp
new file mode 100644 (file)
index 0000000..55f959d
--- /dev/null
@@ -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;
+}