diff --git a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts index e3f3d765002..0a355db5c23 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts +++ b/core/org.eclipse.cdt.ui.tests/resources/refactoring/ImplementMethod.rts @@ -688,3 +688,27 @@ void Class::test() +//! Bug 238253 Pointer refence of the return value lost +//#org.eclipse.cdt.ui.tests.refactoring.implementmethod.ImplementMethodRefactoringTest +//@.config +filename=A.h +//@A.h + +class TestClass { +public: + //$int* get(char* val);$// +}; + + +//@A.cpp +#include "A.h" + +//= +#include "A.h" + +int *TestClass::get(char *val) +{ +} + + + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java index 266ccad3062..e1043ba2de8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java @@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; @@ -181,6 +182,9 @@ public class ImplementMethodRefactoring extends CRefactoring { createdMethodDeclarator = new CPPASTFunctionDeclarator(); createdMethodDeclarator.setName(qname); createdMethodDeclarator.setConst(functionDeclarator.isConst()); + for(IASTPointerOperator pop : functionDeclarator.getPointerOperators()) { + createdMethodDeclarator.addPointerOperator(pop); + } func.setDeclarator(createdMethodDeclarator); func.setBody(new CPPASTCompoundStatement());