[PATCH] D43322: Diagnose cases of "return x" that should be "return std::move(x)" for efficiency

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 19:21:10 PDT 2018


Quuxplusone added a comment.

> Can you post the diagnostic exactly as it appears in the compiler output? I am surprised that it would appear here. It should appear here only if the standard library's implicit conversion from std::map<...>::iterator to std::map<...>::const_iterator were implemented as a conversion operator instead of as a converting constructor. I have verified that both libstdc++ trunk and libc++ trunk implement it "correctly" as a converting constructor, and I have verified on Wandbox/Godbolt that no warning is emitted on your sample code when using either of those standard libraries.
> 
> Is it possible that you are using a standard library that is neither libc++ or libstdc++?
> 
> Is it possible that that standard library implements the iterator-to-const_iterator conversion as a conversion operator instead of a converting constructor?

@thakis ping — did you ever resolve this issue to your satisfaction?


Repository:
  rC Clang

https://reviews.llvm.org/D43322





More information about the cfe-commits mailing list