[Bug c++/60096] c++11 lambda reference capture mistake

2014-02-06 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60096

--- Comment #1 from Jonathan Wakely redi at gcc dot gnu.org ---
This looks invalid to me, you return a closure that holds a dangling reference
to a function parameter that has gone out of scope.


[Bug c++/60096] c++11 lambda reference capture mistake

2014-02-06 Thread feng.w...@uni-ulm.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60096

--- Comment #2 from Feng Wang feng.w...@uni-ulm.de ---
(In reply to Jonathan Wakely from comment #1)
 This looks invalid to me, you return a closure that holds a dangling
 reference to a function parameter that has gone out of scope.

Sorry, my fault. I should have been using a const reference

[]( int const x )
{
  return [x](int const y)
  {
return x+y;
  };
}  
(2)(5);


[Bug c++/60096] c++11 lambda reference capture mistake

2014-02-06 Thread feng.w...@uni-ulm.de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60096

Feng Wang feng.w...@uni-ulm.de changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Feng Wang feng.w...@uni-ulm.de ---
mark as invalid.