[clang] [clang] Add covariance tests that make sure we return an error when return value is different in pointer / lvalue ref / rvalue ref (PR #112853)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 05:38:07 PDT 2024


================
@@ -93,6 +93,38 @@ struct B : A {
 } // namespace example2
 } // namespace cwg952
 
+namespace cwg960 { // cwg960: 2.8
+struct a {};
+class A {
+#if __cplusplus >= 201103L
+  // Check lvalue ref vs rvalue ref vs pointer.
+  virtual a& rvalue_ref();
+  virtual a&& lvalue_ref();
+  virtual a& rvalue_vs_lvalue_ref(); // expected-note{{overridden virtual function is here}}
----------------
Endilll wrote:

```suggestion
  virtual a& rvalue_vs_lvalue_ref(); // #cwg960-rvalue_vs_lvalue_ref
```

https://github.com/llvm/llvm-project/pull/112853


More information about the cfe-commits mailing list