https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881
Bug ID: 102881
Summary: gcc totally broken when trailing return type combine
with decltype lambda
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
template<int N>
using R = decltype([] { return 0; }());
template <int N>
auto you_can_see_me() -> R<N> {
return {};
}
int main() {
you_can_see_me<0>();
}
GCC rejects with:
<source>:10:3: error: 'you_can_see_me' was not declared in this scope
10 | you_can_see_me<0>();
| ^~~~~~~~~~~~~~~~~
https://godbolt.org/z/7WEsjjscT