A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/56456 below:

error when define a move assignment = default (if using type alias) · Issue #56456 · llvm/llvm-project · GitHub

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;
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4