If and only if X supports move semantics the first is is fine.
X might be like:
struct X {
int value;
X() {
static int n;
value = ++n;
}
X(X&&) = default;
X& operator = (X&&) = default;
X(const X&) = delete;
X& operator = (const X&) = delete;
};
Note: No copy of X is allowed, here.