Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331963 - Extract local variable doesn't put template type parameters
Summary: Extract local variable doesn't put template type parameters
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 7.0.2   Edit
Assignee: Emanuel Graf CLA
QA Contact: Emanuel Graf CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-06 18:21 EST by xeor CLA
Modified: 2011-01-04 04:23 EST (History)
1 user (show)

See Also:


Attachments
Patch incl. test cases (5.65 KB, patch)
2011-01-04 04:04 EST, Emanuel Graf CLA
emanuel: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description xeor CLA 2010-12-06 18:21:30 EST
Build Identifier: M20100909-0800

When extracted expression is of template type, the resulting variable will be declared with type name only, without template parameters.

The source of the problem problem seems to be in org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition.getNameCharArray() called by org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor.getQualifiedNameCharArray(IBinding) - only template name is returned 

Reproducible: Always

Steps to Reproduce:
The following sample code:
template<class T>
class Foo
{
};

Foo<int> getFoo();

int main() {

	getFoo(); // This line is selected

	return 0;
}

will result in proposal

Foo getFoo0 = getFoo();
getFoo0;

instead of

Foo<int> getFoo0 = getFoo();
getFoo0;
Comment 1 xeor CLA 2010-12-06 18:44:36 EST
(In reply to comment #0)

> The source of the problem problem seems to be in
> org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateDefinition.getNameCharArray()

Provided the wrong name, the right one is org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSpecialization.getNameCharArray()
Comment 2 Emanuel Graf CLA 2011-01-04 04:04:55 EST
Created attachment 185984 [details]
Patch incl. test cases
Comment 3 Emanuel Graf CLA 2011-01-04 04:17:43 EST
Fixed in HEAD an 7.0 > 20110104