[X86] Move getGFNICtrlMask before CTLZ/CTTZ lowering. NFC.
[llvm-project.git] / clang / test / SemaCXX / consteval-cleanup.cpp
blobf7d033b2ecafa464926f9c4d90fb23504072a856
1 // RUN: %clang_cc1 -fblocks -Wno-unused-value -std=c++20 -ast-dump -verify %s -ast-dump | FileCheck %s
2 // RUN: %clang_cc1 -fblocks -Wno-unused-value -std=c++20 -ast-dump -verify %s -ast-dump -fexperimental-new-constant-interpreter | FileCheck %s
4 // expected-no-diagnostics
6 struct P {
7 consteval P() {}
8 };
10 struct A {
11 A(int v) { this->data = new int(v); }
12 const int& get() const {
13 return *this->data;
15 ~A() { delete data; }
16 private:
17 int *data;
20 void foo() {
21 for (;A(1), P(), false;);
22 // CHECK: foo
23 // CHECK: ExprWithCleanups
24 // CHECK-NEXT: BinaryOperator {{.*}} 'bool' ','
25 // CHECK-NEXT: BinaryOperator {{.*}} 'P' ','
26 // CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'A'
27 // CHECK-NEXT: CXXBindTemporaryExpr {{.*}} 'A'
28 // CHECK-NEXT: CXXConstructExpr {{.*}} 'A'
29 // CHECK: ConstantExpr {{.*}} 'P'
30 // CHECK-NEXT: value:
31 // CHECK-NEXT: ExprWithCleanups
34 void foobar() {
35 A a(1);
36 for (; ^{ auto ptr = &a.get(); }(), P(), false;);
37 // CHECK: ExprWithCleanups
38 // CHECK-NEXT: cleanup Block
39 // CHECK-NEXT: BinaryOperator {{.*}} 'bool' ','
40 // CHECK-NEXT: BinaryOperator {{.*}} 'P' ','
41 // CHECK-NEXT: CallExpr
42 // CHECK-NEXT: BlockExpr
43 // CHECK: ConstantExpr {{.*}} 'P'
44 // CHECK-NEXT: value:
45 // CHECK-NEXT: ExprWithCleanups
46 // CHECK-NOT: cleanup Block
49 struct B {
50 int *p = new int(38);
51 consteval int get() { return *p; }
52 constexpr ~B() { delete p; }
55 void bar() {
56 // CHECK: bar
57 // CHECK: ExprWithCleanups
58 // CHECK: ConstantExpr
59 // CHECK-NEXT: value:
60 // CHECK-NEXT: ExprWithCleanups
61 int k = B().get();