goodfella / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Hanging reference in String StrStreamToString(StrStream*) #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The code in String StrStreamToString(StrStream* ss) creates and later access a 
reference to an anonymous temporary object. This has been reported in 
http://groups.google.com/group/googletestframework/browse_thread/thread/b2286875
f29db0ce.

Original issue reported on code.google.com by vladlosev on 25 Aug 2010 at 9:54

GoogleCodeExporter commented 9 years ago
The source code line is 
http://code.google.com/p/googletest/source/browse/trunk/src/gtest.cc?r=478#1739.

Original comment by vladlosev on 25 Aug 2010 at 9:57

GoogleCodeExporter commented 9 years ago
What's wrong with that line?

Original comment by w...@google.com on 25 Aug 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Oh, the code does indeed seem to be corrects. The temporary string returned by 
stringstream::str() persists for the lifetime of the reference it's bound to, 
so the access to it is valid.

Original comment by vladlosev on 25 Aug 2010 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by vladlosev on 25 Aug 2010 at 10:49