diff --git a/test/test_utility.cpp b/test/test_utility.cpp index a1f28e950..b527a706e 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -80,6 +80,25 @@ namespace static TestClass test; } +#if ETL_USING_CPP11 + namespace ForwardTest + { + constexpr int some_lvalue = 0; + enum ValueType { LVALUE, RVALUE }; + + template + ETL_CONSTEXPR14 ValueType get_value_type(T&) { return LVALUE; } + + template + ETL_CONSTEXPR14 ValueType get_value_type(T&&) { return RVALUE; } + + template + ETL_CONSTEXPR14 ValueType test(T&& value) { + return get_value_type(etl::forward(value)); + } + } // namespace ForwardTest +#endif + namespace { SUITE(test_utility) @@ -666,5 +685,14 @@ namespace CHECK_EQUAL(forward_like_call_type::ConstRValue, template_function_fl(etl::move(u4))); CHECK_EQUAL(forward_like_call_type::ConstRValue, template_function_fl(etl::move(u4))); } + +#if ETL_USING_CPP11 + //********************************* + TEST(test_forward) + { + CHECK_EQUAL(ForwardTest::test(0), ForwardTest::RVALUE); + CHECK_EQUAL(ForwardTest::test(ForwardTest::some_lvalue), ForwardTest::LVALUE); + } +#endif }; }