| Summary: | Generate getters and setters does not handle nested classes in cpp definition | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marc-André Laperle <malaperle> | ||||||
| Component: | cdt-refactoring | Assignee: | Marc-André Laperle <malaperle> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Sergey Prigogin <eclipse.sprigogin> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Jesse.Weinstein, kosashi, yevshif | ||||||
| Version: | 7.0 | ||||||||
| Target Milestone: | 8.3.0 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 171365 [details]
Handle nested classes patch
Created attachment 230043 [details]
Minimal project to verify the problem
Verified with eclipse-SDK-4.3M5a-win32-x86_64.
The refactoring does work if the definitions are inline, obviously. You have to select the "Definition separate from declaration" checkbox to make it generate the invalid code.
I suspect that solving this will depend on bug 402878, which is enhancing the index to track the nested status of classes. Possibly the existing namespace support is sufficient, but probably not. If a committer would add 402878 to the "Depends on" list, that'd be useful. (In reply to comment #3) This bug doesn't depend on bug 402878 since class nesting structure is available in the index. Bug 402878 is about visibility of nested classes, which is irrelevant for this use case. Proposed fix: https://git.eclipse.org/r/13843 Fix applied to master. I created bug 419919 for further improvements to handling namespaces in generated code. |
class TestClass { public: class TestNestedClass { int a; }; TestClass(); virtual ~TestClass(); }; Generates: int TestNestedClass::getA() const { ... void TestNestedClass::setA(int a) { ...