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

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 27 14:32:40 PDT 2021


mizvekov updated this revision to Diff 354773.
mizvekov added a comment.

This introduces two new test cases that cover the bug fixed by the previous diff:

- The one suggested by rsmith in the comments above.
- Another one that shows that when both const and non-const lvref conversion operators where available, we would not pick the const one on the first overload resolution, and end up picking the non-const one on the second.

Trying to think of explanations of how we got this bug in the first place,
I think it boils down to the fact that the first overload resolution was
jerry-rigged into (trying to, unsuccessfully) bailing out in cases where it
would have succceeded without the xvalueness of the expression mattering, and
so the second overload would have hopefully done the same operation, without
affecting the meaning of the program.

The reason for this was diagnostics, it was necessary to get information on whether
casting the expression to rvref would have helped in order to implement the std-move
suggestions. As specified in the standard, the first overload resolution would often
just succeed where it would not have made a difference if the cast was there or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104500

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/SemaCXX/P1155.cpp
  clang/test/SemaCXX/conversion-function.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp
  clang/test/SemaObjCXX/block-capture.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104500.354773.patch
Type: text/x-patch
Size: 57480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210627/41e5f195/attachment-0001.bin>


More information about the cfe-commits mailing list