From 66c33d0a6b3949739ed5e3238a3b38609c611f36 Mon Sep 17 00:00:00 2001 From: Smertig Date: Wed, 6 Jan 2021 12:08:58 +0300 Subject: [PATCH] Fix linkage error in tests (travis, gcc, x86) --- test/test_hooks.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/test_hooks.cpp b/test/test_hooks.cpp index 5f39fdb..d202fcc 100644 --- a/test/test_hooks.cpp +++ b/test/test_hooks.cpp @@ -18,6 +18,11 @@ #error Unknown compiler #endif +int sum(int a, int b) { + return a + b; +} +static_assert(std::is_same_v); + // TODO: remove 'if' when jmp relocation is ready #if RCMP_GET_ARCH() == RCMP_ARCH_X86 @@ -112,10 +117,8 @@ TEST_CASE("cdecl calling convention") { REQUIRE(g1(10, 10.0f) == Approx(198.0f)); - constexpr auto sum = +[](int a, int b) { return a + b; }; constexpr auto converted_sum = rcmp::with_signature>; REQUIRE(converted_sum(1, 2) == sum(1, 2)); - STATIC_REQUIRE(std::is_same_v); STATIC_REQUIRE(std::is_same_v); } @@ -150,10 +153,8 @@ TEST_CASE("stdcall calling convention") { REQUIRE(g2(10, 10) == 198); - constexpr auto sum = +[](int a, int b) { return a + b; }; constexpr auto converted_sum = rcmp::with_signature>; REQUIRE(converted_sum(1, 2) == sum(1, 2)); - STATIC_REQUIRE(std::is_same_v); STATIC_REQUIRE(std::is_same_v); } @@ -178,10 +179,8 @@ TEST_CASE("thiscall calling convention") { REQUIRE(g3(10, 10) == 198); - constexpr auto sum = +[](int a, int b) { return a + b; }; constexpr auto converted_sum = rcmp::with_signature>; REQUIRE(converted_sum(1, 2) == sum(1, 2)); - STATIC_REQUIRE(std::is_same_v); STATIC_REQUIRE(std::is_same_v); } @@ -216,10 +215,8 @@ TEST_CASE("fastcall calling convention") { REQUIRE(g4(10, 10) == 198); - constexpr auto sum = +[](int a, int b) { return a + b; }; constexpr auto converted_sum = rcmp::with_signature>; REQUIRE(converted_sum(1, 2) == sum(1, 2)); - STATIC_REQUIRE(std::is_same_v); STATIC_REQUIRE(std::is_same_v); }