You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See compiler explorer (https://www.godbolt.org/z/GGxKoYGsx) both GCC and MSVC accepts the following code. Clange rejects by giving error of conversion lambda. According to standard, generic lambda should still be convertible to function pointer which is defined by type decltype(+[](T t )->T{return t+1;})
template<typename T>
auto foo(T t, decltype(+[](T t )->T{return t+1;}) lam){
return lam(t);
}
void test(){
foo<int>(5, [](int t){return t+1;});
}
clang13 giving error of
The text was updated successfully, but these errors were encountered:
nickhuang99
changed the title
lambda as function parameter fails to be converted to function pointer
generic lambda as function parameter fails to be converted to pointer to function
Feb 15, 2022
See compiler explorer (https://www.godbolt.org/z/GGxKoYGsx) both GCC and MSVC accepts the following code. Clange rejects by giving error of conversion lambda. According to standard, generic lambda should still be convertible to function pointer which is defined by type
decltype(+[](T t )->T{return t+1;})
clang13 giving error of
The text was updated successfully, but these errors were encountered: