title: Strange behavior in GCC: rvalue ref and lvalue ref are covariant return types
body: <p>I have this little piece of code:</p>
  <pre><code>struct Res { };
  
  struct A {
      virtual Res &amp;&amp;foo();
  };
  
  struct B : A {
      Res &amp;foo() override;
  };
  </code></pre>
  <p>It compiles in GCC, but not in Clang: <a href="https://godbolt.org/z/65rffW" rel="nofollow noreferrer">https://godbolt.org/z/65rffW</a> .</p>
  <p>According to the standard language quoted <a href="https://stackoverflow.com/a/25813596/14756950">here</a>, the lvalue reference is not a covariant return type for an rvalue reference.</p>
  <p>Why doesn't GCC issue an error?</p>