Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/stdx/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ constexpr auto cx_detect1(auto) { return 0; }
STDX_PRAGMA(diagnostic push) \
STDX_PRAGMA(diagnostic ignored "-Wold-style-cast") \
if constexpr (::stdx::is_cx_value_v< \
std::invoke_result_t<decltype(f)>>) { \
std::invoke_result_t<decltype(f)>> or \
std::is_empty_v<std::invoke_result_t<decltype(f)>>) { \
return f(); \
} else if constexpr (CX_DETECT(X)) { \
if constexpr (decltype(::stdx::cxv_detail::is_type< \
Expand Down
2 changes: 1 addition & 1 deletion test/ct_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,6 @@ TEST_CASE("FORMAT a constexpr string_view argument", "[ct_format]") {
}

TEST_CASE("FORMAT an integral_constant argument", "[ct_format]") {
constexpr static auto I = std::integral_constant<int, 17>{};
auto I = std::integral_constant<int, 17>{};
STATIC_REQUIRE(STDX_CT_FORMAT("Hello {}", I) == "Hello 17"_fmt_res);
}
5 changes: 5 additions & 0 deletions test/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,4 +364,9 @@ TEST_CASE("CX_WRAP type argument", "[utility]") {
std::is_same_v<decltype(CX_WRAP(int)()), stdx::type_identity<int>>);
}

TEST_CASE("CX_WRAP integral_constant arg", "[utility]") {
auto x = std::integral_constant<int, 17>{};
STATIC_REQUIRE(std::is_same_v<decltype(CX_WRAP(x)), decltype(x)>);
CHECK(CX_WRAP(x)() == 17);
}
#endif