[Bug c++/86980] Lambda function with return type rvalue reference dtor issue

2018-08-16 Thread neeraj.sharma at alumni dot iitg.ernet.in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86980 --- Comment #3 from Neeraj --- Ah! Alright so the following two code snippets are equivalent. // -- auto f = []() { Traceable tmp; return std::move(tmp); }; // --- auto f = []() -> Traceable { Traceable tm

[Bug c++/86980] Lambda function with return type rvalue reference dtor issue

2018-08-16 Thread neeraj.sharma at alumni dot iitg.ernet.in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86980 --- Comment #2 from Neeraj --- (In reply to Jonathan Wakely from comment #1) > This is a bug in your code, not GCC. you're returning a reference to a local > variable, which goes out of scope, leaving a dangling reference. > I was just playing

[Bug c++/86980] New: Lambda function with return type rvalue reference dtor issue

2018-08-16 Thread neeraj.sharma at alumni dot iitg.ernet.in
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: neeraj.sharma at alumni dot iitg.ernet.in Target Milestone: --- Created attachment 44551 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44551&action=edit preprocessed file