Support for DR2936: Local classes of templated functions should be part of the current instantiation
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Test code ([CE](https://godbolt.org/z/7r76s9h55)):
```cpp
template void f() {
// - EDG: OK
// - GCC/Clang/MSVC: error
[] {}.operator()<0>();
}
```
According to [[temp.dep.type]/10](https://eel.is/c++draft/temp.dep.type#10), the closure type above is not dependent. Even if it happens to be dependent, [[temp.dep.type]/1.5](https://eel.is/c++draft/temp.dep.type#1.5) (added by [CWG2936](https://cplusplus.github.io/CWG/issues/2936.html)) specifies that a local class in a templated function is part of the current instantiation (though I'm not sure whether this applies to closure types):
> - in the definition of a templated function, the name of a local class ([class.local]).
So, I don't think the `template` disambiguator should be required here, as it only adds syntactic noise.
Contributor guide
Assessment
This issue has not been assessed yet.