Bug 107955 - ICE: trying to capture ‘ARGS#0’ in instantiation of generic lambda
Summary: ICE: trying to capture ‘ARGS#0’ in instantiation of generic lambda
Status: RESOLVED DUPLICATE of bug 100295
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2022-12-03 09:01 UTC by Alexander Jung
Modified: 2022-12-03 09:08 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Jung 2022-12-03 09:01:54 UTC
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);
}
Comment 1 Andrew Pinski 2022-12-03 09:08:24 UTC
Duplicate of bug 100295.

*** This bug has been marked as a duplicate of bug 100295 ***