1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 424898 - Parenthesis around reference argument in C++ file

Change-Id: Ief6cf4daa396a48f11a1aa5bcbec0746f6421ef0
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/23024
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2014-03-07 01:05:27 -05:00 committed by Sergey Prigogin
parent c0e82d24a7
commit e74d8ad4d6
2 changed files with 17 additions and 1 deletions

View file

@ -10567,4 +10567,9 @@ public class AST2CPPTests extends AST2TestBase {
public void testFieldAndNestedTypeWithSameName_425033() throws Exception {
parseAndCheckBindings();
}
// void f(double (&(x)));
public void testParenthesizedReferenceArgument_424898() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -36,13 +36,15 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
/**
* C++ specific declarator.
*/
public class CPPASTDeclarator extends ASTNode implements ICPPASTDeclarator, IASTImplicitNameOwner {
public class CPPASTDeclarator extends ASTNode implements ICPPASTDeclarator, IASTImplicitNameOwner,
IASTAmbiguityParent {
private IASTInitializer initializer;
private IASTName name;
private IASTImplicitName[] implicitNames;
@ -318,4 +320,13 @@ public class CPPASTDeclarator extends ASTNode implements ICPPASTDeclarator, IAST
return implicitNames;
}
@Override
public void replace(IASTNode child, IASTNode other) {
if (child == nested) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
nested= (IASTDeclarator) other;
}
}
}