I have this little piece of code:
struct Res { };
struct A {
virtual Res &&foo();
};
struct B : A {
Res &foo() override;
};
It compiles in GCC, but not in Clang: https://godbolt.org/z/65rffW .
According to the standard language quoted here, the lvalue reference is not a covariant return type for an rvalue reference.
Why doesn't GCC issue an error?