1 // UNSUPPORTED: system-aix
2 // see https://github.com/llvm/llvm-project/issues/68092
3 // XFAIL: system-windows
5 // RUN: cat %s | clang-repl | FileCheck %s
6 // RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s
8 extern "C" int printf(const char*, ...);
10 struct A
{ int val
; A(int v
); ~A(); void f() const; };
11 A::A(int v
) : val(v
) { printf("A(%d), this = %p\n", val
, this); }
12 A::~A() { printf("~A, this = %p, val = %d\n", this, val
); }
13 void A::f() const { printf("f: this = %p, val = %d\n", this, val
); }
16 // CHECK: A(1), this = [[THIS:.+]]
17 // The constructor must only be called once!
21 // CHECK-NEXT: f: this = [[THIS]], val = 1
23 // CHECK-NEXT: f: this = [[THIS]], val = 1
26 // There must still be no other constructor!
29 // At the end, we expect exactly one destructor call
31 // CHECK-SAME: this = [[THIS]], val = 1