https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114504
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-03-27
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So it looks like it is just an issue with the way requires is handled.
That is doing it outside of a requires rejects the code correctly:
```
...
template <typename T>
int f(void)
{
[]<T t> {};
return 0;
}
auto t = f<NonStructuralType>();
```
Is rejected correctly with:
```
<source>: In instantiation of 'int f() [with T = NonStructuralType]':
<source>:24:30: required from here
24 | auto t = f<NonStructuralType>();
| ~~~~~~~~~~~~~~~~~~~~^~
<source>:20:9: error: 'NonStructuralType' is not a valid type for a template
non-type parameter because it is not structural
20 | []<T t> {};
| ^~~~~~~~~~
<source>:10:9: note: 'NonStructuralType::a' is not public
10 | int a;
| ^
```