| 1 |
// { dg-do compile { target c++20 } } |
| 2 |
|
| 3 |
struct S { |
| 4 |
template <int I> |
| 5 |
using T = decltype([]{ return I; }); |
| 6 |
|
| 7 |
template <int I> |
| 8 |
decltype([]{ return I; }) f(); // { dg-error "declared using local type" } |
| 9 |
}; |
| 10 |
|
| 11 |
void a(S::T<0>*); // { dg-error "declared using local type" } |
| 12 |
void b(S::T<1>*); // { dg-error "declared using local type" } |
| 13 |
void c(decltype(S{}.f<0>())*); // { dg-error "declared using local type" } |
| 14 |
void d(decltype(S{}.f<1>())*); // { dg-error "declared using local type" } |
| 15 |
|
| 16 |
int main() { |
| 17 |
a(nullptr); |
| 18 |
b(nullptr); |
| 19 |
c(nullptr); |
| 20 |
d(nullptr); |
| 21 |
S{}.f<2>()(); |
| 22 |
} |