Issue |
136472
|
Summary |
Clang errors for out-of-line definition with deducing-this of non-templated type nested within templated type
|
Labels |
clang
|
Assignees |
|
Reporter |
scrossuk
|
Given this code:
```
template <typename T>
struct Type final
{
struct Nested
{
void method(this auto& self);
};
};
template <typename T>
void Type<T>::Nested::method(this auto& self) {}
```
Clang reports ([Godbolt](https://godbolt.org/z/9MqhEGPsK)):
```
<source>:11:30: error: an explicit object parameter cannot appear in a non-member function
11 | void Type<T>::Nested::method(this auto& self) {}
```
Note that a work around is to make the nested type also be a template ([Godbolt](https://godbolt.org/z/WWjKe5WPv)):
```
template <typename T>
struct Type final
{
template <typename Unused>
struct Nested
{
void method(this auto& self);
};
};
template <typename T>
template <typename Unused>
void Type<T>::Nested<Unused>::method(this auto& self) {}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs