[Bug c++/46056] [C++0x] range-based for loop does not destruct iterators

rodrigorivascosta at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 20 08:56:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46056

--- Comment #6 from Rodrigo Rivas <rodrigorivascosta at gmail dot com> 2010-10-20 08:56:30 UTC ---
Ok, thank you for the report...
It looks like the range-for temporary completely ignore destructors.

Also, if the range is a temporary it gets destructed quite early, instead of
being kept alive because of the implicit reference.

for (auto x : temp() )
//the temporary is destroyed here
{
   //...
} //instead of here

It shouldn't be too difficult to patch, though, so I'll try and have a patch in
a while...



More information about the Gcc-bugs mailing list