1 // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
4 __attribute__((noinline
)) const IntHolder
&Self() const {
10 const IntHolder
*saved
;
12 int main(int argc
, char *argv
[]) {
13 saved
= &IntHolder().Self();
14 int x
= saved
->val
; // BOOM
15 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
16 // CHECK: #0 0x{{.*}} in main {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]]