From dc44b95ab0cc988afd225d0eb9f7021f96fcd2b6 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 6 Mar 2023 10:26:02 -0800 Subject: Support lvalue references to incomplete types as `FunctionRef` parameters. PiperOrigin-RevId: 514451518 Change-Id: Ic1391374c7bff08ba437ac0410631d1f701bb9ed --- absl/functional/function_ref_test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'absl/functional/function_ref_test.cc') diff --git a/absl/functional/function_ref_test.cc b/absl/functional/function_ref_test.cc index 412027cd..d0923fdd 100644 --- a/absl/functional/function_ref_test.cc +++ b/absl/functional/function_ref_test.cc @@ -253,6 +253,16 @@ TEST(FunctionRef, PassByValueTypes) { } } +TEST(FunctionRef, ReferenceToIncompleteType) { + struct IncompleteType; + auto test = [](IncompleteType&) {}; + absl::FunctionRef ref(test); + + struct IncompleteType {}; + IncompleteType obj; + ref(obj); +} + } // namespace ABSL_NAMESPACE_END } // namespace absl -- cgit v1.2.3