Bug 399144 - 'Extract local variable' refactoring writes empty string for type of lambda
Summary: 'Extract local variable' refactoring writes empty string for type of lambda
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-25 21:02 EST by Nathan Ridge CLA
Modified: 2020-09-04 15:23 EDT (History)
3 users (show)

See Also:


Attachments
Minimal project to verify the problem (1.94 KB, application/x-zip-compressed)
2013-02-05 14:44 EST, Jesse Weinstein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2013-01-25 21:02:05 EST
Steps to reproduce:

1. Start with the following code:

template <typename F> void foo(F);
int main() 
{
    foo([](int x){ return x + 1; });
}

2. Select the lambda expression and perform the 'extract local variable' refactoring. The result is:

template <typename F> void foo(F);
int main() 
{
    f = [](int x)
    {
        return x + 1;
    };
    foo (f);
}

which does not compile. The type of the lambda should be 'auto' instead.
Comment 1 Jesse Weinstein CLA 2013-02-05 14:44:36 EST
Created attachment 226586 [details]
Minimal project to verify the problem

I've now verified (a slight modification of) this using eclipse-SDK-N20130203-2000-win32 with org.eclipse.cdt_8.2.0.201212170456 . Here's the project, to make it easier for other people to verify it.
Comment 2 Jesse Weinstein CLA 2013-02-05 14:45:12 EST
Sorry, it didn't actually require any modifications. Copy-paste error.