[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 26 17:04:10 PDT 2021


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaStmt.cpp:3469
+    if (Res == OR_Success || Res == OR_Deleted) {
+      // Promote "AsRvalue" to the heap, since we now need
+      // expression node to persist.
----------------
Looks like you lost a word in this comment.


================
Comment at: clang/lib/Sema/SemaStmt.cpp:3478-3481
+        // Check that overload resolution selected a conversion operator
+        // taking an rvalue reference.
+        if (cast<CXXMethodDecl>(FD)->getRefQualifier() != RQ_RValue)
+          break;
----------------
Is the removal of this check for an rvalue ref qualifier a bugfix? If so, please add a test. I suppose it would look something like this:
```
struct B;
struct A { A(B&) = delete; };
struct B { operator A(); };
A f() { B b; return b; }
```
... which would be ambiguous if we don't implicitly convert to xvalue, but if we do, it selects a conversion function that is not rvalue-ref-qualified.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104500/new/

https://reviews.llvm.org/D104500



More information about the cfe-commits mailing list