1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "callback.h"
6 
Test()7 void Test() {
8   using base::BindOnce;
9   using base::Passed;
10   int i = 0;
11   int* p = nullptr;
12 
13   // Passed takes a pointer and the address is taken here.
14   // Remove `&` and replace base::Passed with std::move.
15   base::BindOnce([] {}, base::Passed(&i));
16 
17   // Passed takes a pointer. Replace base::Passed with std::move plus deref.
18   base::BindOnce([] {}, base::Passed(p));
19 
20   // The parameter is already rvalue-reference. Just remove base::Passed.
21   // Plus, check if unqualified names work.
22   base::BindOnce([] {}, Passed(std::move(*p)));
23   BindOnce([] {}, base::Passed(1));
24 }
25