diff --git a/include/stdx/utility.hpp b/include/stdx/utility.hpp index 18ebd01..20db122 100644 --- a/include/stdx/utility.hpp +++ b/include/stdx/utility.hpp @@ -260,14 +260,16 @@ constexpr auto is_aligned_with = [](auto v) -> bool { }; #if __cplusplus >= 202002L - namespace detail { template struct ct_helper { // NOLINTNEXTLINE(google-explicit-constructor) - CONSTEVAL ct_helper(T t) : value(t) {} + CONSTEVAL ct_helper(auto t) : value(t) {} T value; }; + template ct_helper(T) -> ct_helper; +template +ct_helper(std::integral_constant) -> ct_helper; template CONSTEVAL auto cx_detect0() {} CONSTEVAL auto cx_detect1(auto) { return 0; } diff --git a/test/utility.cpp b/test/utility.cpp index a7eceec..1fa2c46 100644 --- a/test/utility.cpp +++ b/test/utility.cpp @@ -260,6 +260,12 @@ TEST_CASE("ct (integral)", "[utility]") { std::integral_constant const>); } +TEST_CASE("ct (integral constant)", "[utility]") { + constexpr auto vs = stdx::ct{}>(); + STATIC_REQUIRE( + std::is_same_v const>); +} + TEST_CASE("ct (bool)", "[utility]") { constexpr auto v = stdx::ct(); STATIC_REQUIRE(std::is_same_v const>);