mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Bug 233889.
This commit is contained in:
parent
7bf06f5e35
commit
fe9a0ddd82
4 changed files with 20 additions and 10 deletions
|
@ -1008,7 +1008,7 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
// func(&C::m1);
|
||||
// func(&C::m2);
|
||||
// }
|
||||
public void _testAddressOfConstMethod_233889() throws Exception {
|
||||
public void testAddressOfConstMethod_233889() throws Exception {
|
||||
IBinding fn1= getBindingFromASTName("func(&C::m1", 4, ICPPFunction.class);
|
||||
IBinding fn2= getBindingFromASTName("func(&C::m2", 4, ICPPFunction.class);
|
||||
assertNotSame(fn1, fn2);
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexType;
|
||||
|
||||
|
@ -30,7 +31,7 @@ import org.eclipse.cdt.internal.core.index.IIndexType;
|
|||
* @author aniefer
|
||||
*/
|
||||
public class CPPPointerToMemberType extends CPPPointerType implements ICPPPointerToMemberType {
|
||||
private ICPPASTPointerToMember operator;
|
||||
private ICPPASTPointerToMember operator;
|
||||
private IType classType; // Can be either ICPPClassType or ICPPTemplateTypeParameter
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ public class CPPPointerToMemberType extends CPPPointerType implements ICPPPointe
|
|||
ICPPASTPointerToMember pm = operator;
|
||||
IASTName name = pm.getName();
|
||||
if (name instanceof ICPPASTQualifiedName) {
|
||||
IASTName[] ns = ((ICPPASTQualifiedName)name).getNames();
|
||||
IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
|
||||
if (ns.length > 1)
|
||||
name = ns[ns.length - 2];
|
||||
else
|
||||
|
@ -91,4 +92,14 @@ public class CPPPointerToMemberType extends CPPPointerType implements ICPPPointe
|
|||
}
|
||||
return classType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConst() {
|
||||
return super.isConst() || (getType() instanceof ICPPFunctionType && ((ICPPFunctionType) getType()).isConst());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVolatile() {
|
||||
return super.isVolatile() || (getType() instanceof ICPPFunctionType && ((ICPPFunctionType) getType()).isVolatile());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -665,7 +665,6 @@ public class CPPSemantics {
|
|||
nextTmplScope= enclosingTemplateScope(data.astName);
|
||||
}
|
||||
|
||||
|
||||
while (nextScope != null || nextTmplScope != null) {
|
||||
// when the non-template scope is no longer contained within the first template scope,
|
||||
// we use the template scope for the next iteration.
|
||||
|
@ -2040,7 +2039,7 @@ public class CPPSemantics {
|
|||
final IType[] targetParameters = getTargetParameterTypes(currFn);
|
||||
final int useImplicitObj = (currFn instanceof ICPPMethod && !(currFn instanceof ICPPConstructor)) ? 1 : 0;
|
||||
final int sourceLen= Math.max(sourceParameters.length + useImplicitObj, 1);
|
||||
final int numTargetParams= Math.max(targetParameters.length, 1+useImplicitObj);
|
||||
final int numTargetParams= Math.max(targetParameters.length, 1 + useImplicitObj);
|
||||
|
||||
if (currFnCost == null || currFnCost.length != sourceLen) {
|
||||
currFnCost= new Cost[sourceLen];
|
||||
|
@ -2051,13 +2050,13 @@ public class CPPSemantics {
|
|||
boolean isImpliedObject= false;
|
||||
for (int j = 0; j < sourceLen; j++) {
|
||||
if (useImplicitObj > 0) {
|
||||
isImpliedObject= j==0;
|
||||
isImpliedObject= (j == 0);
|
||||
source= isImpliedObject ? impliedObjectType : sourceParameters[j - 1];
|
||||
Object se= isImpliedObject || data.functionParameters.length==0 ? null : data.functionParameters[j - 1];
|
||||
sourceExp= se instanceof IASTExpression ? (IASTExpression) se : null;
|
||||
Object se= isImpliedObject || data.functionParameters.length == 0 ? null : data.functionParameters[j - 1];
|
||||
sourceExp= se instanceof IASTExpression ? (IASTExpression) se : null;
|
||||
} else {
|
||||
source = sourceParameters[j];
|
||||
Object se= data.functionParameters.length==0 ? null : data.functionParameters[j];
|
||||
Object se= data.functionParameters.length == 0 ? null : data.functionParameters[j];
|
||||
sourceExp= se instanceof IASTExpression ? (IASTExpression) se : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class PDOMCPPPointerToMemberType extends PDOMPointerType implements ICPPPointerT
|
|||
}
|
||||
@Override
|
||||
public Object clone() {
|
||||
return new PDOMCPPPointerToMemberTypeClone(this);
|
||||
return new PDOMCPPPointerToMemberTypeClone((ICPPPointerToMemberType) delegate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue