Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread Jonathan Wakely
On 4 August 2011 11:31, LIM Fung-Chai wrote: > Hi, > > On Thu, Aug 4, 2011 at 5:29 PM, Miles Bader wrote: >> Jonathan Wakely writes: "g++ -Wall -Wextra ..." should flag a warning on the following code but does not. >>> >>> Thanks for the apology, but it should still be reported to bugzi

Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread Miles Bader
Jonathan Wakely writes: > No, returning a reference to a local variable is always wrong, not > only because Meyers says so. True ... :} -miles -- Apologize, v. To lay the foundation for a future offense.

Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread LIM Fung-Chai
Hi, On Thu, Aug 4, 2011 at 5:29 PM, Miles Bader wrote: > Jonathan Wakely writes: >>> "g++ -Wall -Wextra ..." should flag a warning on the following code >>> but does not. >> >> Thanks for the apology, but it should still be reported to bugzilla >> not to this list. I was hoping someone could su

Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread Jonathan Wakely
On 4 August 2011 10:29, Miles Bader wrote: > Jonathan Wakely writes: >>> "g++ -Wall -Wextra ..." should flag a warning on the following code >>> but does not. >> >> Thanks for the apology, but it should still be reported to bugzilla >> not to this list. > > BTW, it should only warn if given -Weffc

Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread Miles Bader
Jonathan Wakely writes: >> "g++ -Wall -Wextra ..." should flag a warning on the following code >> but does not. > > Thanks for the apology, but it should still be reported to bugzilla > not to this list. BTW, it should only warn if given -Weffc++, right? -Miles -- People who are more than casu

Re: g++ 2.5.2 does not catch reference to local variable error.

2011-08-04 Thread Jonathan Wakely
On 4 August 2011 03:30, LIM Fung-Chai wrote: > Hi, > > "g++ -Wall -Wextra ..." should flag a warning on the following code > but does not. > > std::pair > get_XYZ_data() > { >    XYZ result; >    return std::pair(1, result); > } > > This is a violation of Scott Meyer's "Effective C++" Item 21 "Don

g++ 2.5.2 does not catch reference to local variable error.

2011-08-03 Thread LIM Fung-Chai
Hi, "g++ -Wall -Wextra ..." should flag a warning on the following code but does not. std::pair get_XYZ_data() { XYZ result; return std::pair(1, result); } This is a violation of Scott Meyer's "Effective C++" Item 21 "Don't try to return a reference when you must return an object." GCC