/* * Copyright (c) 2024, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ // RUN: %clang++ -cc1 -verify %plugin_opts% %s 2>&1 #include void take_fn(Function) { } void take_fn_escaping(ESCAPING Function) { } void test() { // expected-note@+1 {{Annotate the variable declaration with IGNORE_USE_IN_ESCAPING_LAMBDA if it outlives the lambda}} int a = 0; take_fn([&a] { (void)a; }); // expected-warning@+1 {{Variable with local storage is captured by reference in a lambda marked ESCAPING}} take_fn_escaping([&a] { (void)a; }); }