1// Copyright 2023 The Chromium Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// This is a "No Compile Test" suite. 6// http://dev.chromium.org/developers/testing/no-compile-tests 7 8#include <utility> 9 10#include "base/test/bind.h" 11 12namespace base { 13 14void BindMutableLambdaForTesting() { 15 // `BindLambdaForTesting()` requires mutable lambdas to be non-const rvalues. 16 auto l = []() mutable {}; 17 const auto const_l = []() mutable {}; 18 BindLambdaForTesting(l); // expected-error@*:* {{BindLambdaForTesting() requires non-const rvalue for mutable lambda binding, i.e. base::BindLambdaForTesting(std::move(lambda)).}} 19 BindLambdaForTesting(std::move(const_l)); // expected-error@*:* {{BindLambdaForTesting() requires non-const rvalue for mutable lambda binding, i.e. base::BindLambdaForTesting(std::move(lambda)).}} 20} 21 22} // namespace base 23