| Issue |
56456
|
| Summary |
error when define a move assignment = default (if using type alias)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
TwinKleS-C
|
For some reason, I used a type alias when defining the move constructor, which compiles successfully on msvc and gcc, but clang doesn't allow it
I tested other special member functions, copy constructor, move constructor, copy assignment function can all use the =default declaration explicitly in the case of using type alias, only move assignment function does not allow this, but it can use =delete explicitly, so is this a bug?
here is my test code
```
// constant reference
template <typename T>
using RC = T const &;
// non-constant reference
template <typename T>
using RV = T &;
// r-value reference
template <typename T>
using RM = T&&;
struct A {
// default constructor
A () = default;
// copy constructor
A (RC<A>) = default;
// move constructor
A (RM<A>) = default;
// copy assignment
auto operator = (RC<A>) -> RV<A> = default;
// move assignment
auto operator = (RM<A>) -> RV<A> = default; // error: only special member functions may be defaulted
//auto operator = (RM<A>) -> RV<A> = delete; // OK
};
int main () {
return 0;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs