15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <functional>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // reference_wrapper
125a83710eSEric Fiselier 
135a83710eSEric Fiselier // template <ObjectType T> reference_wrapper<T> ref(T& t);
145a83710eSEric Fiselier 
155a83710eSEric Fiselier #include <functional>
165a83710eSEric Fiselier #include <cassert>
175a83710eSEric Fiselier 
187fc6a556SMarshall Clow #include "test_macros.h"
197fc6a556SMarshall Clow 
test()20*a13c1058SArthur O'Dwyer TEST_CONSTEXPR_CXX20 bool test()
215a83710eSEric Fiselier {
225a83710eSEric Fiselier   int i = 0;
235a83710eSEric Fiselier   std::reference_wrapper<int> r = std::ref(i);
245a83710eSEric Fiselier   assert(&r.get() == &i);
25*a13c1058SArthur O'Dwyer   return true;
26*a13c1058SArthur O'Dwyer }
27*a13c1058SArthur O'Dwyer 
main(int,char **)28*a13c1058SArthur O'Dwyer int main(int, char**)
29*a13c1058SArthur O'Dwyer {
30*a13c1058SArthur O'Dwyer   test();
31*a13c1058SArthur O'Dwyer #if TEST_STD_VER > 17
32*a13c1058SArthur O'Dwyer   static_assert(test());
33*a13c1058SArthur O'Dwyer #endif
342df59c50SJF Bastien 
352df59c50SJF Bastien   return 0;
365a83710eSEric Fiselier }
37