42 lines · cpp
1// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s2// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s3// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s4// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s5// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s6// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s7// RUN: %clang_cc1 -std=c++2c -triple x86_64-unknown-unknown %s -verify=expected -fexceptions -fcxx-exceptions -pedantic-errors -ast-dump | FileCheck %s8 9// expected-no-diagnostics10 11namespace cwg2353 { // cwg2353: 912 struct X {13 static const int n = 0;14 };15 16 // CHECK: FunctionDecl {{.*}} use17 int use(X x) {18 // CHECK: MemberExpr {{.*}} .n19 // CHECK-NOT: non_odr_use20 // CHECK: DeclRefExpr {{.*}} 'x'21 // CHECK-NOT: non_odr_use22 return *&x.n;23 }24#pragma clang __debug dump use25 26 // CHECK: FunctionDecl {{.*}} not_use27 int not_use(X x) {28 // CHECK: MemberExpr {{.*}} .n {{.*}} non_odr_use_constant29 // CHECK: DeclRefExpr {{.*}} 'x'30 return x.n;31 }32#pragma clang __debug dump not_use33 34 // CHECK: FunctionDecl {{.*}} not_use_235 int not_use_2(X *x) {36 // CHECK: MemberExpr {{.*}} ->n {{.*}} non_odr_use_constant37 // CHECK: DeclRefExpr {{.*}} 'x'38 return x->n;39 }40#pragma clang __debug dump not_use_241} // namespace cwg235342