| 1 |
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 3 |
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 4 |
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 5 |
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 6 |
// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 7 |
// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s |
| 8 |
|
| 9 |
// expected-no-diagnostics |
| 10 |
|
| 11 |
namespace cwg2353 { // cwg2353: 9 |
| 12 |
struct X { |
| 13 |
static const int n = 0; |
| 14 |
}; |
| 15 |
|
| 16 |
// CHECK: FunctionDecl {{.*}} use |
| 17 |
int use(X x) { |
| 18 |
// CHECK: MemberExpr {{.*}} .n |
| 19 |
// CHECK-NOT: non_odr_use |
| 20 |
// CHECK: DeclRefExpr {{.*}} 'x' |
| 21 |
// CHECK-NOT: non_odr_use |
| 22 |
return *&x.n; |
| 23 |
} |
| 24 |
#pragma clang __debug dump use |
| 25 |
|
| 26 |
// CHECK: FunctionDecl {{.*}} not_use |
| 27 |
int not_use(X x) { |
| 28 |
// CHECK: MemberExpr {{.*}} .n {{.*}} non_odr_use_constant |
| 29 |
// CHECK: DeclRefExpr {{.*}} 'x' |
| 30 |
return x.n; |
| 31 |
} |
| 32 |
#pragma clang __debug dump not_use |
| 33 |
|
| 34 |
// CHECK: FunctionDecl {{.*}} not_use_2 |
| 35 |
int not_use_2(X *x) { |
| 36 |
// CHECK: MemberExpr {{.*}} ->n {{.*}} non_odr_use_constant |
| 37 |
// CHECK: DeclRefExpr {{.*}} 'x' |
| 38 |
return x->n; |
| 39 |
} |
| 40 |
#pragma clang __debug dump not_use_2 |
| 41 |
} // namespace cwg2353 |