https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104138
Bug ID: 104138
Summary: ICE when lambda is passed as parameter
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nickhuang99 at hotmail dot com
Target Milestone: ---
Considering following valid code which compiles with clang13. It defines a
concept to restrict template parameter as type of lambda. Then the concept is
used to constraint class A to have a lambda as constructor parameter. The ICE
happens when a lambda object is passed to constructor of A.
#include<type_traits>
using Lambda=decltype(+[](){});
template<typename T>
concept IsLambda=std::is_same<decltype(+[](){}), T>::value;
template<IsLambda L>
struct A{
A(L lam){
lam();
}
};
auto lam=+[](){};
auto a=A<Lambda>(lam);
https://www.godbolt.org/z/Pxv95Eb14