[clang] [clang] Substitute alias templates from correct context (PR #75069)
Jordan Rupprecht via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 14 12:59:33 PST 2023
rupprecht wrote:
After this commit, I'm seeing another "out-of-line definition" error for `operator=` on the following reduced snippet:
```c++
class Foo {};
template <class X, class Y = void>
struct Stuff;
template <class Unused>
struct Stuff<Foo, Unused> {
Stuff& operator=(Stuff&& that);
};
template <class T>
using Alias = Stuff<Foo, T>;
template <class T>
Alias<T>& Alias<T>::operator=(Alias<T>&& that) {
return *this;
}
```
Results in:
```c++
<source>:15:21: error: out-of-line definition of 'operator=' does not match any declaration in 'Stuff<Foo, type-parameter-0-0>'
15 | Alias<T>& Alias<T>::operator=(Alias<T>&& that) {
| ^~~~~~~~
```
Is that error expected?
Live conformance view: https://godbolt.org/z/eanhMEevn
I'm also seeing a separate `template argument for template type parameter must be a type; did you forget 'typename'?` error nearby. I could add `typename` to appease the compiler, although I'm not sure if it's supposed to be necessary.
https://github.com/llvm/llvm-project/pull/75069
More information about the cfe-commits
mailing list