The code is valid If you comment out the if, it compiles. If you comment out the branches in the if, it compiles as well. But somehow putting them together gives ICE. #include <functional> template<typename F> struct agg_p { F f; void _parse(auto...ARGS){ [&](auto...P_ARGS){ using result = std::invoke_result_t<F,decltype(ARGS)...,decltype(P_ARGS)...>; if constexpr(!std::same_as<result, void>){ f(ARGS...,P_ARGS...); }else{ f(ARGS...,P_ARGS...); } }(1); } }; int main(){ auto add = [](auto a, auto b){return a+b;}; auto agg = agg_p(add); int i; agg._parse(i); }
Duplicate of bug 100295. *** This bug has been marked as a duplicate of bug 100295 ***