summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/drs/dr23xx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CXX/drs/dr23xx.cpp')
-rw-r--r--clang/test/CXX/drs/dr23xx.cpp42
1 files changed, 37 insertions, 5 deletions
diff --git a/clang/test/CXX/drs/dr23xx.cpp b/clang/test/CXX/drs/dr23xx.cpp
index 87db0d4c9b7..8e7a9a880bf 100644
--- a/clang/test/CXX/drs/dr23xx.cpp
+++ b/clang/test/CXX/drs/dr23xx.cpp
@@ -1,13 +1,45 @@
-// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++2a %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
#if __cplusplus <= 201103L
// expected-no-diagnostics
#endif
+namespace dr2353 { // dr2353: 9
+ struct X {
+ static const int n = 0;
+ };
+
+ // CHECK: FunctionDecl {{.*}} use
+ int use(X x) {
+ // CHECK: MemberExpr {{.*}} .n
+ // CHECK-NOT: non_odr_use
+ // CHECK: DeclRefExpr {{.*}} 'x'
+ // CHECK-NOT: non_odr_use
+ return *&x.n;
+ }
+#pragma clang __debug dump use
+
+ // CHECK: FunctionDecl {{.*}} not_use
+ int not_use(X x) {
+ // CHECK: MemberExpr {{.*}} .n {{.*}} non_odr_use_constant
+ // CHECK: DeclRefExpr {{.*}} 'x'
+ return x.n;
+ }
+#pragma clang __debug dump not_use
+
+ // CHECK: FunctionDecl {{.*}} not_use_2
+ int not_use_2(X *x) {
+ // CHECK: MemberExpr {{.*}} ->n {{.*}} non_odr_use_constant
+ // CHECK: DeclRefExpr {{.*}} 'x'
+ return x->n;
+ }
+#pragma clang __debug dump not_use_2
+}
+
namespace dr2387 { // dr2387: 9
#if __cplusplus >= 201402L
template<int> int a = 0;
OpenPOWER on IntegriCloud