[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / symbol-reaper-lambda.cpp
blobc63562b4d430b78b81d8b8a73a4d4e6b909ddd04
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
2 // expected-no-diagnostics
4 template <typename... Ts>
5 void escape(Ts&...);
6 struct Dummy {};
8 int strange(Dummy param) {
9 Dummy local_pre_lambda;
10 int ref_captured = 0;
12 // LambdaExpr is modeled as lazyCompoundVal of tempRegion, that contains
13 // all captures. In this instance, this region contains a pointer/reference
14 // to ref_captured variable.
15 auto fn = [&] {
16 escape(param, local_pre_lambda);
17 return ref_captured; // no-warning: The value is not garbage.
20 int local_defined_after_lambda; // Unused, but necessary! Important that it's before the call.
22 // The ref_captured binding should not be pruned at this point, as it is still
23 // accessed via reference captured in operator() of fn.
24 return fn();