https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117530
Bug ID: 117530
Summary: Mismatch of lambda type with itself in recursive alias
declaration
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nshead at gcc dot gnu.org
Target Milestone: ---
The following testcase based off the testcase in PR86171 fails starting with
GCC14 (it worked in GCC13):
template <class> struct A;
template <class T> using B = decltype([]() -> A<T>::X { return 0; });
template <class T> struct A {
typedef int X;
typedef B<T> U;
};
B<short> b;
$ g++ -std=c++20 test.cpp
test.cpp: In substitution of ‘template<class T> using B = decltype (<lambda>)
[with T = short int]’:
test.cpp:7:8: required from here
7 | B<short> b;
| ^
test.cpp:2:26: error: conflicting declaration ‘using B = struct<lambda()>’
2 | template <class T> using B = decltype([]() -> A<T>::X { return 0; });
| ^
test.cpp:2:26: note: previous declaration as ‘using B = struct<lambda()>’