| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // <functional> |
| 10 | |
| 11 | // reference_wrapper |
| 12 | |
| 13 | // template <ObjectType T> reference_wrapper<T> ref(T& t); |
| 14 | |
| 15 | // Don't allow binding to a temp |
| 16 | |
| 17 | #include <functional> |
| 18 | |
| 19 | struct A {}; |
| 20 | |
| 21 | const A source() {return A();} |
| 22 | |
| 23 | int main(int, char**) |
| 24 | { |
| 25 | std::reference_wrapper<const A> r = std::ref(source()); |
| 26 | (void)r; |
| 27 | |
| 28 | return 0; |
| 29 | } |
| 30 | |