diff --git a/include/stdx/utility.hpp b/include/stdx/utility.hpp index 8607aef..e740ece 100644 --- a/include/stdx/utility.hpp +++ b/include/stdx/utility.hpp @@ -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>) { \ + std::invoke_result_t> or \ + std::is_empty_v>) { \ return f(); \ } else if constexpr (CX_DETECT(X)) { \ if constexpr (decltype(::stdx::cxv_detail::is_type< \ diff --git a/test/ct_format.cpp b/test/ct_format.cpp index b8d028b..941b592 100644 --- a/test/ct_format.cpp +++ b/test/ct_format.cpp @@ -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{}; + auto I = std::integral_constant{}; STATIC_REQUIRE(STDX_CT_FORMAT("Hello {}", I) == "Hello 17"_fmt_res); } diff --git a/test/utility.cpp b/test/utility.cpp index 8d924c2..4042d84 100644 --- a/test/utility.cpp +++ b/test/utility.cpp @@ -364,4 +364,9 @@ TEST_CASE("CX_WRAP type argument", "[utility]") { std::is_same_v>); } +TEST_CASE("CX_WRAP integral_constant arg", "[utility]") { + auto x = std::integral_constant{}; + STATIC_REQUIRE(std::is_same_v); + CHECK(CX_WRAP(x)() == 17); +} #endif