[Bug c++/86256] Lambda will not add ref count for class intelligent pointer member when capture 'this' or & as argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 --- Comment #4 from kangchuanbo at 126 dot com --- OK, thanks for your response, I just met this issue and think it's better to give warn or error when Lambda capture this or reference with std::shared_ptr member inside. So add one Lambda usage attention maybe a better way to prevent such issue happen again. Have a nice day, thanks. At 2018-06-24 14:15:37, "redi at gcc dot gnu.org" wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 > >Jonathan Wakely changed: > > What|Removed |Added > > Status|WAITING |RESOLVED > Resolution|--- |INVALID > >--- Comment #3 from Jonathan Wakely --- >But this is true for any lambda that captured 'this' or captures by reference. >It doesn't make sense to warn for every use of that language feature, just in >case it's used incorrectly. > >-- >You are receiving this mail because: >You reported the bug.
[Bug c++/86256] Lambda will not add ref count for class intelligent pointer member when capture 'this' or & as argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 Jonathan Wakely changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #3 from Jonathan Wakely --- But this is true for any lambda that captured 'this' or captures by reference. It doesn't make sense to warn for every use of that language feature, just in case it's used incorrectly.
[Bug c++/86256] Lambda will not add ref count for class intelligent pointer member when capture 'this' or & as argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 --- Comment #2 from kangchuanbo at 126 dot com --- Once Lamdba capture this ( one class instance which have std::shared_ptr<> member), the std::shared_ptr member will not increase ref count inside Lambda body, this is dangerous, once this member has been freed, the Lambda body will access null pointer. At 2018-06-21 19:47:22, "redi at gcc dot gnu.org" wrote: >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 > >Jonathan Wakely changed: > > What|Removed |Added > > Status|UNCONFIRMED |WAITING > Last reconfirmed||2018-06-21 > Ever confirmed|0 |1 > >--- Comment #1 from Jonathan Wakely --- >N.B. GCC 5.4 is no longer supported or maintained. > >I don't understand your bug report, GCC is compiling the code correctly. > >What do you think should happen? > >-- >You are receiving this mail because: >You reported the bug.
[Bug c++/86256] Lambda will not add ref count for class intelligent pointer member when capture 'this' or & as argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86256 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2018-06-21 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- N.B. GCC 5.4 is no longer supported or maintained. I don't understand your bug report, GCC is compiling the code correctly. What do you think should happen?