File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -260,14 +260,16 @@ constexpr auto is_aligned_with = [](auto v) -> bool {
260260};
261261
262262#if __cplusplus >= 202002L
263-
264263namespace detail {
265264template <typename T> struct ct_helper {
266265 // NOLINTNEXTLINE(google-explicit-constructor)
267- CONSTEVAL ct_helper (T t) : value(t) {}
266+ CONSTEVAL ct_helper (auto t) : value(t) {}
268267 T value;
269268};
269+
270270template <typename T> ct_helper (T) -> ct_helper<T>;
271+ template <typename T, T I>
272+ ct_helper (std::integral_constant<T, I>) -> ct_helper<T>;
271273
272274template <auto > CONSTEVAL auto cx_detect0 () {}
273275CONSTEVAL auto cx_detect1 (auto ) { return 0 ; }
Original file line number Diff line number Diff line change @@ -260,6 +260,12 @@ TEST_CASE("ct (integral)", "[utility]") {
260260 std::integral_constant<unsigned int , 42 > const >);
261261}
262262
263+ TEST_CASE (" ct (integral constant)" , " [utility]" ) {
264+ constexpr auto vs = stdx::ct<std::integral_constant<int , 42 >{}>();
265+ STATIC_REQUIRE (
266+ std::is_same_v<decltype (vs), std::integral_constant<int , 42 > const >);
267+ }
268+
263269TEST_CASE (" ct (bool)" , " [utility]" ) {
264270 constexpr auto v = stdx::ct<true >();
265271 STATIC_REQUIRE (std::is_same_v<decltype (v), std::bool_constant<true > const >);
You can’t perform that action at this time.
0 commit comments