mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 21:36:05 +00:00

Since an immediate invocation is a full expression itself - it requires an additional ExprWithCleanups node, but it can participate to a bigger full expression which actually requires cleanups to be run after. Thanks @ilya-biryukov for helping reducing the reproducer and confirming that the analysis is correct. Fixes https://github.com/llvm/llvm-project/issues/60709 Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D153962
22 lines
411 B
C++
22 lines
411 B
C++
// RUN: %clang_cc1 -std=c++20 -Wno-unused-value -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s
|
|
|
|
struct P {
|
|
consteval P() {}
|
|
};
|
|
|
|
struct A {
|
|
A(int v) { this->data = new int(v); }
|
|
~A() { delete data; }
|
|
private:
|
|
int *data;
|
|
};
|
|
|
|
void foo() {
|
|
for (;A(1), P(), false;);
|
|
// CHECK: foo
|
|
// CHECK: for.cond:
|
|
// CHECK: call void @_ZN1AC1Ei
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
// CHECK: for.body
|
|
}
|