1 // UNSUPPORTED: system-aix, system-zos
2 // see https://github.com/llvm/llvm-project/issues/68092
3 // XFAIL: host={{.*}}-windows-msvc
5 // The test is flaky with asan https://github.com/llvm/llvm-project/issues/102858.
8 // RUN: cat %s | clang-repl | FileCheck %s
9 // RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
11 extern "C" int printf(const char*, ...);
13 struct A
{ int val
; A(int v
); ~A(); void f() const; };
14 A::A(int v
) : val(v
) { printf("A(%d), this = %p\n", val
, this); }
15 A::~A() { printf("~A, this = %p, val = %d\n", this, val
); }
16 void A::f() const { printf("f: this = %p, val = %d\n", this, val
); }
19 // CHECK: A(1), this = [[THIS:.+]]
20 // The constructor must only be called once!
24 // CHECK-NEXT: f: this = [[THIS]], val = 1
26 // CHECK-NEXT: f: this = [[THIS]], val = 1
29 // There must still be no other constructor!
32 // At the end, we expect exactly one destructor call
34 // CHECK-SAME: this = [[THIS]], val = 1