https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102721
--- Comment #5 from qingzhe huang <nickhuang99 at hotmail dot com> ---
(In reply to qingzhe huang from comment #4)
> (In reply to Andrew Pinski from comment #2)
> > Note it is not array related either:
> > template<>
> > void A<decltype(+[]{})>::foo(const decltype(+[]{}))
> > {}
>
> Yes, it is not array-related. But it is definitely member function issue
> with out-of line definition. See this works fine:
>
> template<class T>
> void foo(const T){}
>
> template<>
> void foo<decltype(+[]{})>(const decltype(+[]{})); //declaration
>
> template<>
> void foo<decltype(+[]{})>(const decltype(+[]{}))
> {}
Also interestingly, consider these following two cases:
1. template-class-member-function:
template<class T>
struct A{
void foo(const T){}
};
template<>
void A<decltype(+[]{})>::foo(const decltype(+[]{})){}
2. class-with-template-member-function:
struct A{
template<class T>
void foo(const T){}
};
template<>
void A::foo<decltype(+[]{})>(const decltype(+[]{})){}
Only case #1 has such issue.