diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-01 18:49:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-01 18:49:26 +0000 |
commit | 11ab79030938209f50691acae0ddb65e72a58ca9 (patch) | |
tree | 3d3d5b91699328ba5b49f8fab04fa4fcbf91693f /lib/Sema/SemaStmt.cpp | |
parent | 82aa713bcda99f388836c2a30bb868d9c9974817 (diff) |
Emit error when using a bound member function for something other than calling it.
Also avoids IRGen crashes due to accepting invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index ddee9cca6d..4c586e5e02 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -74,6 +74,12 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) { if (!E) return; + if (E->isBoundMemberFunction(Context)) { + Diag(E->getLocStart(), diag::err_invalid_use_of_bound_member_func) + << E->getSourceRange(); + return; + } + SourceLocation Loc; SourceRange R1, R2; if (!E->isUnusedResultAWarning(Loc, R1, R2, Context)) |