Skip to content

Commit

Permalink
fix: make interface mocks compiling on clang-18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DNKpp committed Sep 25, 2024
1 parent 38dfc1e commit aaf09c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions include/mimic++/InterfaceMock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ namespace mimicpp
* \ingroup MOCK_INTERFACES_DETAIL_FORWARD_ARGS
*/
#define MIMICPP_DETAIL_FORWARD_ARGS(...) \
__VA_OPT__(,) \
MIMICPP_DETAIL_FOR_EACH_EXT( \
MIMICPP_DETAIL_FORWARD_ARG, \
i, \
Expand Down Expand Up @@ -349,9 +348,7 @@ namespace mimicpp
#define MIMICPP_DETAIL_MAKE_METHOD_OVERRIDE(ignore, mock_name, fn_name, ret, param_type_list, specs, param_list, forward_list, ...) \
inline MIMICPP_DETAIL_STRIP_PARENS(ret) fn_name param_list MIMICPP_DETAIL_STRIP_PARENS(specs) override \
{ \
return ::std::invoke( \
mock_name \
MIMICPP_DETAIL_STRIP_PARENS(forward_list)); \
return mock_name (MIMICPP_DETAIL_STRIP_PARENS(forward_list)); \
}

/**
Expand Down
12 changes: 6 additions & 6 deletions test/unit-tests/InterfaceMock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ TEST_CASE(

REQUIRE_THAT(
TO_STRING(MIMICPP_DETAIL_FORWARD_ARGS(int)),
Matches::Equals(", ::std::forward<::std::add_rvalue_reference_t< int>>(arg_i)"));
Matches::Equals("::std::forward<::std::add_rvalue_reference_t< int>>(arg_i)"));

REQUIRE_THAT(
TO_STRING(MIMICPP_DETAIL_FORWARD_ARGS(const int&, int&&)),
Matches::Matches(
", ::std::forward<::std::add_rvalue_reference_t< const int&>>\\(arg_i\\)\\s*,"
"::std::forward<::std::add_rvalue_reference_t< const int&>>\\(arg_i\\)\\s*,"
" ::std::forward<::std::add_rvalue_reference_t< int&&>>\\(arg_ii\\)"));

REQUIRE_THAT(
TO_STRING(MIMICPP_DETAIL_FORWARD_ARGS(int, int)),
Matches::Matches(", ::std::forward<::std::add_rvalue_reference_t< int>>\\(arg_i\\)\\s*,"
Matches::Matches("::std::forward<::std::add_rvalue_reference_t< int>>\\(arg_i\\)\\s*,"
" ::std::forward<::std::add_rvalue_reference_t< int>>\\(arg_ii\\)"));

REQUIRE_THAT(
TO_STRING(MIMICPP_DETAIL_FORWARD_ARGS((std::tuple<int, float>))),
Matches::Equals(", ::std::forward<::std::add_rvalue_reference_t< std::tuple<int, float>>>(arg_i)"));
Matches::Equals("::std::forward<::std::add_rvalue_reference_t< std::tuple<int, float>>>(arg_i)"));
}

TEST_CASE(
Expand All @@ -180,7 +180,7 @@ TEST_CASE(
Matches::Matches(
"\\(const int&&, \\(const std::string&\\s*, int&&\\), const noexcept, "
"\\(const std::string& arg_i\\s*, int&& arg_ii\\), "
"\\(, ::std::forward<::std::add_rvalue_reference_t< const std::string&>>\\(arg_i\\)\\s*, "
"\\(::std::forward<::std::add_rvalue_reference_t< const std::string&>>\\(arg_i\\)\\s*, "
"::std::forward<::std::add_rvalue_reference_t< int&&>>\\(arg_ii\\)\\)\\)"));

REQUIRE_THAT(
Expand All @@ -192,7 +192,7 @@ TEST_CASE(
Matches::Matches(
"\\(void, \\(\\(std::tuple<int, float>\\)\\),\\s*, "
"\\(std::tuple<int, float> arg_i\\), "
"\\(, ::std::forward<::std::add_rvalue_reference_t< std::tuple<int, float>>>\\(arg_i\\)\\)\\)"));
"\\(::std::forward<::std::add_rvalue_reference_t< std::tuple<int, float>>>\\(arg_i\\)\\)\\)"));
}

TEST_CASE(
Expand Down

0 comments on commit aaf09c2

Please sign in to comment.