https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128612
Bug ID: 128612
Summary: compiler rejects valid alias-declaration with
defining-type-id of decltype(lambda-expression)
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: irvsrc at gmail dot com
Target Milestone: ---
Example:
```
template<typename t> // remove = ok
struct type {
using ty = decltype([] { return 0; }()); // error
// remove = ok
template<ty v>
auto static fn() { }
};
auto main() -> int {
type<int>::fn<10>();
}
```
Output:
```
<source>: In lambda function:
<source>:3:37: error: invalid use of 'auto'
3 | using ty = decltype([] { return 0; }()); // error
| ^
<source>:3:37: error: could not convert '0' from 'int' to 'auto'
3 | using ty = decltype([] { return 0; }()); // error
| ^
| |
| int
<source>: In function 'int main()':
<source>:11:22: error: no matching function for call to 'type<int>::fn<10>()'
11 | type<int>::fn<10>();
| ~~~~~~~~~~~~~~~~~^~
• there is 1 candidate
• candidate 1: 'template<decltype (<lambda>()) v> static auto type<t>::fn()
[with decltype (<lambda>()) v = v; t = int]'
<source>:7:17:
7 | auto static fn() { }
| ^~
• substitution of deduced template arguments resulted in errors seen
above
Compiler returned: 1
```
GCC (trunk), -std=c++26