clang/test/Analysis/copy-elision.mm
raw| 1 | // RUN: %clang_analyze_cc1 -analyzer-checker=core -fblocks -verify %s |
| 2 | |
| 3 | // expected-no-diagnostics |
| 4 | |
| 5 | namespace block_rvo_crash { |
| 6 | struct A {}; |
| 7 | |
| 8 | A getA(); |
| 9 | void use(A a) {} |
| 10 | |
| 11 | void foo() { |
| 12 | // This used to crash when finding construction context for getA() |
| 13 | // (which is use()'s argument due to RVO). |
| 14 | use(^{ |
| 15 | return getA(); // no-crash |
| 16 | }()); |
| 17 | } |
| 18 | } // namespace block_rvo_crash |