Hello David, Sorry to come so late into the discussion, but...
On 21/06/12 00:50, Xinliang David Li wrote: > One of the most common runtime errors we have seen in gcc-4_7 is > caused by dangling references to temporaries whole life time have > ended > > e.g, > > const A& a = foo(); > > or > foo (A());// where temp's address is saved and used after foo. > > Of course this is user error according to the standard, > [...] ... is the first of your 2 examples really a user error? If so, it breaks GotW #88: A Candidate For the “Most Important const” [1]. Can you please clarify? Thanks in advance! Olivier [1] http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/