Index: libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/cref.incomplete.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// +// +// reference_wrapper +// +// template reference_wrapper cref(const T& t); +// +// where T is an incomplete type (since C++20) + +#include +#include + + +struct Foo; + +Foo& get_foo(); + +void test() { + Foo const& foo = get_foo(); + std::reference_wrapper ref = std::cref(foo); + assert(&ref.get() == &foo); +} + +struct Foo { }; + +Foo& get_foo() { + static Foo foo; + return foo; +} + +int main() { + test(); +} Index: libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/utilities/function.objects/refwrap/refwrap.helpers/ref.incomplete.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// +// +// reference_wrapper +// +// template reference_wrapper ref(T& t); +// +// where T is an incomplete type (since C++20) + +#include +#include + + +struct Foo; + +Foo& get_foo(); + +void test() { + Foo& foo = get_foo(); + std::reference_wrapper ref = std::ref(foo); + assert(&ref.get() == &foo); +} + +struct Foo { }; + +Foo& get_foo() { + static Foo foo; + return foo; +} + +int main() { + test(); +} Index: libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp =================================================================== --- /dev/null +++ libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/ctor.incomplete.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// +// +// reference_wrapper +// +// where T is an incomplete type (since C++20) + + +#include +#include + + +struct Foo; + +Foo& get_foo(); + +void test() { + Foo& foo = get_foo(); + std::reference_wrapper ref{foo}; + assert(&ref.get() == &foo); +} + +struct Foo { }; + +Foo& get_foo() { + static Foo foo; + return foo; +} + +int main() { + test(); +} Index: libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.fail.cpp =================================================================== --- /dev/null +++ libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/invoke.incomplete.fail.cpp @@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 + +// +// +// reference_wrapper +// +// template +// std::invoke_result_t +// operator()(ArgTypes&&... args) const; +// +// Requires T to be a complete type (since C++20). + +#include + + +struct Foo; +Foo& get_foo(); + +void test() { + std::reference_wrapper ref = get_foo(); + ref(0); // incomplete at the point of call +} + +struct Foo { void operator()(int) const { } }; +Foo& get_foo() { static Foo foo; return foo; } + +int main() { + test(); +} Index: libcxx/www/cxx2a_status.html =================================================================== --- libcxx/www/cxx2a_status.html +++ libcxx/www/cxx2a_status.html @@ -110,7 +110,7 @@ P0318R1LWGunwrap_ref_decay and unwrap_referenceSan Diego P0356R5LWGSimplified partial function applicationSan Diego - P0357R3LWGreference_wrapper for incomplete typesSan Diego + P0357R3LWGreference_wrapper for incomplete typesSan DiegoComplete8.0 P0482R6CWGchar8_t: A type for UTF-8 characters and stringsSan Diego P0487R1LWGFixing operator>>(basic_istream&, CharT*) (LWG 2499)San Diego P0591R4LWGUtility functions to implement uses-allocator constructionSan Diego