From 736b381d132035639709852f4942f739f1664144 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 17 Dec 2024 10:55:34 -0800 Subject: [PATCH] add failing test case Passing an lvalue ref parameter when arguments are by-value causes a failure of reference binding. --- test/function_ref_fn_test.cpp | 3 ++- test/function_ref_mfn_test.cpp | 3 ++- test/function_ref_obj_test.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/function_ref_fn_test.cpp b/test/function_ref_fn_test.cpp index 79e8065..a5ca519 100644 --- a/test/function_ref_fn_test.cpp +++ b/test/function_ref_fn_test.cpp @@ -98,8 +98,9 @@ int main() { // f1 { + int x = 1; compat::function_ref fv1(f1); - BOOST_TEST_EQ(fv1(1), 1); + BOOST_TEST_EQ(fv1(x), 1); compat::function_ref fv2(f1); BOOST_TEST_EQ(fv2(1), 1); diff --git a/test/function_ref_mfn_test.cpp b/test/function_ref_mfn_test.cpp index 17e8c11..292f3a1 100644 --- a/test/function_ref_mfn_test.cpp +++ b/test/function_ref_mfn_test.cpp @@ -41,8 +41,9 @@ int main() { compat::function_ref fn1(compat::nontype_t<&F1::m1>{}); BOOST_TEST_EQ(fn1(f1), 0); + int x = 2; compat::function_ref fn2(compat::nontype_t<&F1::m2>{}); - BOOST_TEST_EQ(fn2(f1, 2), 12); + BOOST_TEST_EQ(fn2(f1, x), 12); compat::function_ref fn3(compat::nontype_t<&F1::m3>{}); BOOST_TEST_EQ(fn3(f1, 2, 3), 123); diff --git a/test/function_ref_obj_test.cpp b/test/function_ref_obj_test.cpp index e9b4e62..98e0eb2 100644 --- a/test/function_ref_obj_test.cpp +++ b/test/function_ref_obj_test.cpp @@ -65,8 +65,8 @@ int main() { BOOST_TEST_TRAIT_FALSE((std::is_constructible, F1 const&&>)); compat::function_ref fv2(f); - - BOOST_TEST_EQ(fv2(1), 1); + int x = 1; + BOOST_TEST_EQ(fv2(x), 1); BOOST_TEST_TRAIT_FALSE((std::is_constructible, F1 const>)); BOOST_TEST_TRAIT_FALSE((std::is_constructible, F1 const&>));