summaryrefslogtreecommitdiffstats
path: root/test/CXX
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-01-04 16:58:14 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-01-04 16:58:14 +0000
commitbf91d084aea415a34bd7d8fbb2ca5c8c4aa74db9 (patch)
treed245c93daa6e08278c4e72b1769ef9b3d1d4dc1e /test/CXX
parent4e3dd793d75b1710618a091fa8a037c5a75c2525 (diff)
Refactor the way we handle diagnosing unused expression results.
Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350404 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/stmt.stmt/stmt.select/p3.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/CXX/stmt.stmt/stmt.select/p3.cpp b/test/CXX/stmt.stmt/stmt.select/p3.cpp
index 7a6a408ec9..4804cc559d 100644
--- a/test/CXX/stmt.stmt/stmt.select/p3.cpp
+++ b/test/CXX/stmt.stmt/stmt.select/p3.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++1z -Wc++14-compat -verify %s -DCPP17
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-unused-value -std=c++1z -Wc++14-compat -verify %s -DCPP17
int f();
@@ -71,7 +71,6 @@ void whileInitStatement() {
// last loop above. It would be nice to remove this.
void whileInitStatement2() {
while (; false) {} // expected-error {{expected expression}}
- // expected-warning@-1 {{expression result unused}}
- // expected-error@-2 {{expected ';' after expression}}
- // expected-error@-3 {{expected expression}}
+ // expected-error@-1 {{expected ';' after expression}}
+ // expected-error@-2 {{expected expression}}
}