Skip to content

Commit b325dd5

Browse files
authored
Merge pull request #247 from elbeno/cx-fixes
2 parents 2e5c17f + 5f2a90b commit b325dd5

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

include/stdx/utility.hpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ template <typename T> constexpr auto is_ct_v<T const> = is_ct_v<T>;
234234

235235
#ifndef CX_VALUE
236236
#define CX_VALUE(...) \
237-
[&]() constexpr { \
237+
[]() constexpr { \
238238
STDX_PRAGMA(diagnostic push) \
239239
STDX_PRAGMA(diagnostic ignored "-Wold-style-cast") \
240240
STDX_PRAGMA(diagnostic ignored "-Wunused-value") \
@@ -274,7 +274,10 @@ template <typename T> constexpr auto is_ct_v<T const> = is_ct_v<T>;
274274
}([&] { return X; })
275275

276276
#ifdef __clang__
277-
#define CX_DETECT(X) std::is_empty_v<decltype(CX_VALUE(X))>
277+
#define CX_DETECT(X) \
278+
std::is_empty_v<decltype([&] { \
279+
return (X) + ::stdx::cxv_detail::type_val{}; \
280+
})>
278281
#else
279282
namespace stdx {
280283
inline namespace v1 {
@@ -290,10 +293,11 @@ constexpr auto cx_detect1(auto) { return 0; }
290293
#endif
291294

292295
#define CX_WRAP(X) \
293-
[&]<typename F>(F f) { \
296+
[&](auto f) { \
294297
STDX_PRAGMA(diagnostic push) \
295298
STDX_PRAGMA(diagnostic ignored "-Wold-style-cast") \
296-
if constexpr (::stdx::is_cx_value_v<std::invoke_result_t<F>>) { \
299+
if constexpr (::stdx::is_cx_value_v< \
300+
std::invoke_result_t<decltype(f)>>) { \
297301
return f(); \
298302
} else if constexpr (CX_DETECT(X)) { \
299303
if constexpr (decltype(::stdx::cxv_detail::is_type< \

0 commit comments

Comments
 (0)