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

2018-05-15 Thread Andrea Arteaga via cfe-users
Dear all, Recently, my team suffered from a bug due to a double bad usage of C++. We have a function returning a reference to an object: Object& GetObject(); Sometimes we use this function like this: auto obj = GetObject(); This triggers a copy of the object, which we really don't mean

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

2018-05-15 Thread George Karpenkov via cfe-users
+cfe-dev Hi Andrea, I think you might get more luck asking on the cfe-dev mailing list. George > On May 15, 2018, at 1:15 PM, Andrea Arteaga via cfe-users > wrote: > > Dear all, > Recently, my team suffered from a bug due to a double bad usage of C++. > > We have a function returning a refe

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

2018-05-15 Thread Richard Smith via cfe-users
On 15 May 2018 at 16:01, John McCall via cfe-dev wrote: > On May 15, 2018, at 6:05 PM, George Karpenkov via cfe-dev < > cfe-...@lists.llvm.org> wrote: > > +cfe-dev > > Hi Andrea, > > I think you might get more luck asking on the cfe-dev mailing list. > > > George > > On May 15, 2018, at 1:15 PM,

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

2018-05-15 Thread John McCall via cfe-users
> On May 15, 2018, at 6:05 PM, George Karpenkov via cfe-dev > wrote: > > +cfe-dev > > Hi Andrea, > > I think you might get more luck asking on the cfe-dev mailing list. > > George > >> On May 15, 2018, at 1:15 PM, Andrea Arteaga via cfe-users >> mailto:cfe-users@lists.llvm.org>> wrote: >>

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

2018-05-15 Thread John McCall via cfe-users
> On May 15, 2018, at 7:23 PM, Richard Smith wrote: > On 15 May 2018 at 16:01, John McCall via cfe-dev > wrote: >> On May 15, 2018, at 6:05 PM, George Karpenkov via cfe-dev >> mailto:cfe-...@lists.llvm.org>> wrote: >> >> +cfe-dev >> >> Hi Andrea, >> >> I think y

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

2018-05-15 Thread Andrea Arteaga via cfe-users
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. It's still one of those warnings I would like to see when writing code in an IDE, not when compiling the full