1 // RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && \
2 // RUN: %t 2>&1 | FileCheck %s
4 // Lifetime for temporaries is not emitted yet.
10 explicit IntHolder(int val
) : val(val
) {
11 printf("IntHolder: %d\n", val
);
16 const IntHolder
*saved
;
18 void save(const IntHolder
&holder
) {
22 int main(int argc
, char *argv
[]) {
24 int x
= saved
->val
; // BOOM
25 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
26 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cc:[[@LINE-2]]
27 printf("saved value: %d\n", x
);