[cfe-users] [cfe-dev] Warnings for implicit constructors and wrong usage of auto

Csaba Raduly via cfe-users cfe-users at lists.llvm.org
Wed May 16 00:53:35 PDT 2018


On 5/16/18, Andrea Arteaga via cfe-users <cfe-users at lists.llvm.org> wrote:
> Thanks for your reply, John.
>
> I fully understand your points, I actually had the same concern that a
> reference-to-rvalue warning would be issued for perfectly reasonable and
> intended code.

For example,

vector<int> ints{1,2,3,4,5};
auto i = ints.front();

Also, one may want to take a copy, e.g. for modifying it:

vector<string> strings{"foo", "bar"};
auto foo = strings.front();
foo.append{"tball"};

Csaba
-- 
You can get very substantial performance improvements by not doing the
right thing.
   - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers
(C++TDaWYK)



More information about the cfe-users mailing list