mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 18:25:40 +02:00
Bug 402498 - Name resolution error for unqualified function call with
dependent argument Change-Id: I31b86885e2e715c38b10efeed3aef4aee1c0d249 Reviewed-on: https://git.eclipse.org/r/11073 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:
parent
62eeab5ef6
commit
7a715b258f
8 changed files with 178 additions and 63 deletions
|
@ -7539,10 +7539,47 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
// void foo(T t) {
|
// void foo(T t) {
|
||||||
// bar(t);
|
// bar(t);
|
||||||
// }
|
// }
|
||||||
public void testUnqualifiedFunctionCallInTemplate_402498() throws Exception {
|
public void testUnqualifiedFunctionCallInTemplate_402498a() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename T>
|
||||||
|
// auto foo(T t) -> decltype(bar(t));
|
||||||
|
//
|
||||||
|
// namespace N {
|
||||||
|
// class A {};
|
||||||
|
// int bar(A);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int main() {
|
||||||
|
// auto x = foo(N::A());
|
||||||
|
// }
|
||||||
|
public void testUnqualifiedFunctionCallInTemplate_402498b() throws Exception {
|
||||||
|
new BindingAssertionHelper(getAboveComment(), true).assertVariableType("x", CommonTypes.int_);
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <typename T>
|
||||||
|
// auto foo(T t) -> decltype(bar(t));
|
||||||
|
//
|
||||||
|
// namespace N {
|
||||||
|
// class A {};
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int bar(A);
|
||||||
|
//
|
||||||
|
// int main() {
|
||||||
|
// auto x = foo(N::A());
|
||||||
|
// }
|
||||||
|
public void testUnqualifiedFunctionCallInTemplate_402498c() throws Exception {
|
||||||
|
BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true);
|
||||||
|
ICPPVariable x = helper.assertNonProblem("x", ICPPVariable.class);
|
||||||
|
// We really should assert that x's type is a ProblemType, but the semantic
|
||||||
|
// analyzer is too lenient and makes it a TypeOfDependentExpression if it
|
||||||
|
// can't instantiate the return type of foo() properly.
|
||||||
|
// That's another bug for another day.
|
||||||
|
assertFalse(x.getType().isSameType(CommonTypes.int_));
|
||||||
|
}
|
||||||
|
|
||||||
// template <typename>
|
// template <typename>
|
||||||
// struct no_type {};
|
// struct no_type {};
|
||||||
//
|
//
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemType;
|
||||||
public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPFunction, ICPPComputableFunction {
|
public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPFunction, ICPPComputableFunction {
|
||||||
private static final ICPPFunctionType FUNCTION_TYPE=
|
private static final ICPPFunctionType FUNCTION_TYPE=
|
||||||
new CPPFunctionType(ProblemType.UNKNOWN_FOR_EXPRESSION, IType.EMPTY_TYPE_ARRAY);
|
new CPPFunctionType(ProblemType.UNKNOWN_FOR_EXPRESSION, IType.EMPTY_TYPE_ARRAY);
|
||||||
private static final ICPPFunction[] NO_CANDIDATES= {};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a CPPDeferredFunction given a set of overloaded functions
|
* Creates a CPPDeferredFunction given a set of overloaded functions
|
||||||
|
@ -52,7 +51,7 @@ public class CPPDeferredFunction extends CPPUnknownBinding implements ICPPFuncti
|
||||||
* @return the constructed CPPDeferredFunction
|
* @return the constructed CPPDeferredFunction
|
||||||
*/
|
*/
|
||||||
public static ICPPFunction createForName(char[] name) {
|
public static ICPPFunction createForName(char[] name) {
|
||||||
return new CPPDeferredFunction(null, name, NO_CANDIDATES);
|
return new CPPDeferredFunction(null, name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IBinding fOwner;
|
private final IBinding fOwner;
|
||||||
|
|
|
@ -562,8 +562,12 @@ public class CPPSemantics {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void doKoenigLookup(LookupData data) throws DOMException {
|
public static void doKoenigLookup(LookupData data) throws DOMException {
|
||||||
data.ignoreUsingDirectives = true;
|
data.ignoreUsingDirectives = true;
|
||||||
|
// Set 'qualified' to true for the duration of this function call
|
||||||
|
// so the calls to lookup() don't ascend into enclosing scopes.
|
||||||
|
boolean originalQualified = data.qualified;
|
||||||
|
data.qualified = true;
|
||||||
Set<ICPPFunction> friendFns = new HashSet<ICPPFunction>(2);
|
Set<ICPPFunction> friendFns = new HashSet<ICPPFunction>(2);
|
||||||
Set<ICPPNamespaceScope> associated = getAssociatedScopes(data, friendFns);
|
Set<ICPPNamespaceScope> associated = getAssociatedScopes(data, friendFns);
|
||||||
for (ICPPNamespaceScope scope : associated) {
|
for (ICPPNamespaceScope scope : associated) {
|
||||||
|
@ -572,6 +576,7 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mergeResults(data, friendFns.toArray(), false);
|
mergeResults(data, friendFns.toArray(), false);
|
||||||
|
data.qualified = originalQualified;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IBinding checkDeclSpecifier(IBinding binding, IASTName name, IASTNode decl) {
|
static IBinding checkDeclSpecifier(IBinding binding, IASTName name, IASTNode decl) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2012, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
import org.eclipse.cdt.internal.core.dom.parser.Value;
|
||||||
|
@ -46,21 +47,41 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
// the type of 'obj' (needed for correct overload resolution of 'member_function' later).
|
// the type of 'obj' (needed for correct overload resolution of 'member_function' later).
|
||||||
// Otherwise null.
|
// Otherwise null.
|
||||||
private final IType fImpliedObjectType;
|
private final IType fImpliedObjectType;
|
||||||
|
|
||||||
|
// Used to represent an EvalFunctionSet with zero functions.
|
||||||
|
// (We need the name in resolveFunction() - usually we get it from the CPPFunctionSet
|
||||||
|
// by asking the first function in the set for its name.)
|
||||||
|
// Exactly one of fFunctionSet and fName should be non-null.
|
||||||
|
private final char[] fName;
|
||||||
|
|
||||||
public EvalFunctionSet(CPPFunctionSet set, boolean addressOf, IType impliedObjectType, IASTNode pointOfDefinition) {
|
public EvalFunctionSet(CPPFunctionSet set, boolean addressOf, IType impliedObjectType, IASTNode pointOfDefinition) {
|
||||||
this(set, addressOf, impliedObjectType, findEnclosingTemplate(pointOfDefinition));
|
this(set, addressOf, impliedObjectType, findEnclosingTemplate(pointOfDefinition));
|
||||||
}
|
}
|
||||||
|
|
||||||
public EvalFunctionSet(CPPFunctionSet set, boolean addressOf, IType impliedObjectType, IBinding templateDefinition) {
|
public EvalFunctionSet(CPPFunctionSet set, boolean addressOf, IType impliedObjectType, IBinding templateDefinition) {
|
||||||
super(templateDefinition);
|
super(templateDefinition);
|
||||||
fFunctionSet= set;
|
fFunctionSet= set;
|
||||||
fAddressOf= addressOf;
|
fAddressOf= addressOf;
|
||||||
fImpliedObjectType= impliedObjectType;
|
fImpliedObjectType= impliedObjectType;
|
||||||
|
fName= null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvalFunctionSet(char[] name, boolean addressOf, IASTNode pointOfDefinition) {
|
||||||
|
this(name, addressOf, findEnclosingTemplate(pointOfDefinition));
|
||||||
|
}
|
||||||
|
|
||||||
|
public EvalFunctionSet(char[] name, boolean addressOf, IBinding templateDefinition) {
|
||||||
|
super(templateDefinition);
|
||||||
|
fFunctionSet= null;
|
||||||
|
fAddressOf= addressOf;
|
||||||
|
fImpliedObjectType= null;
|
||||||
|
fName= name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPFunctionSet getFunctionSet() {
|
public CPPFunctionSet getFunctionSet() {
|
||||||
return fFunctionSet;
|
return fFunctionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAddressOf() {
|
public boolean isAddressOf() {
|
||||||
return fAddressOf;
|
return fAddressOf;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +102,8 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTypeDependent() {
|
public boolean isTypeDependent() {
|
||||||
|
if (fFunctionSet == null)
|
||||||
|
return true;
|
||||||
final ICPPTemplateArgument[] args = fFunctionSet.getTemplateArguments();
|
final ICPPTemplateArgument[] args = fFunctionSet.getTemplateArguments();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
for (ICPPTemplateArgument arg : args) {
|
for (ICPPTemplateArgument arg : args) {
|
||||||
|
@ -115,54 +138,74 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
return PRVALUE;
|
return PRVALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Descriptive names for flags used during serialization.
|
||||||
|
private final static short FLAG_ADDRESS_OF = ITypeMarshalBuffer.FLAG1;
|
||||||
|
private final static short FLAG_HAS_FUNCTION_SET = ITypeMarshalBuffer.FLAG2;
|
||||||
|
private final static short FLAG_HAS_TEMPLATE_ARGS = ITypeMarshalBuffer.FLAG3;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException {
|
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException {
|
||||||
final ICPPFunction[] bindings = fFunctionSet.getBindings();
|
|
||||||
final ICPPTemplateArgument[] args = fFunctionSet.getTemplateArguments();
|
|
||||||
short firstBytes = ITypeMarshalBuffer.EVAL_FUNCTION_SET;
|
short firstBytes = ITypeMarshalBuffer.EVAL_FUNCTION_SET;
|
||||||
if (fAddressOf)
|
if (fAddressOf)
|
||||||
firstBytes |= ITypeMarshalBuffer.FLAG1;
|
firstBytes |= FLAG_ADDRESS_OF;
|
||||||
if (args != null)
|
if (fFunctionSet != null) {
|
||||||
firstBytes |= ITypeMarshalBuffer.FLAG2;
|
firstBytes |= FLAG_HAS_FUNCTION_SET;
|
||||||
|
final ICPPFunction[] bindings = fFunctionSet.getBindings();
|
||||||
|
final ICPPTemplateArgument[] args = fFunctionSet.getTemplateArguments();
|
||||||
|
if (args != null)
|
||||||
|
firstBytes |= FLAG_HAS_TEMPLATE_ARGS;
|
||||||
|
|
||||||
buffer.putShort(firstBytes);
|
buffer.putShort(firstBytes);
|
||||||
buffer.putInt(bindings.length);
|
buffer.putInt(bindings.length);
|
||||||
for (ICPPFunction binding : bindings) {
|
for (ICPPFunction binding : bindings) {
|
||||||
buffer.marshalBinding(binding);
|
buffer.marshalBinding(binding);
|
||||||
}
|
|
||||||
if (args != null) {
|
|
||||||
buffer.putInt(args.length);
|
|
||||||
for (ICPPTemplateArgument arg : args) {
|
|
||||||
buffer.marshalTemplateArgument(arg);
|
|
||||||
}
|
}
|
||||||
|
if (args != null) {
|
||||||
|
buffer.putInt(args.length);
|
||||||
|
for (ICPPTemplateArgument arg : args) {
|
||||||
|
buffer.marshalTemplateArgument(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buffer.marshalType(fImpliedObjectType);
|
||||||
|
} else {
|
||||||
|
buffer.putShort(firstBytes);
|
||||||
|
buffer.putCharArray(fName);
|
||||||
}
|
}
|
||||||
buffer.marshalType(fImpliedObjectType);
|
|
||||||
marshalTemplateDefinition(buffer);
|
marshalTemplateDefinition(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException {
|
public static ISerializableEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException {
|
||||||
final boolean addressOf= (firstBytes & ITypeMarshalBuffer.FLAG1) != 0;
|
final boolean addressOf= (firstBytes & FLAG_ADDRESS_OF) != 0;
|
||||||
int bindingCount= buffer.getInt();
|
if ((firstBytes & FLAG_HAS_FUNCTION_SET) != 0) {
|
||||||
ICPPFunction[] bindings= new ICPPFunction[bindingCount];
|
int bindingCount= buffer.getInt();
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
ICPPFunction[] bindings= new ICPPFunction[bindingCount];
|
||||||
bindings[i]= (ICPPFunction) buffer.unmarshalBinding();
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
}
|
bindings[i]= (ICPPFunction) buffer.unmarshalBinding();
|
||||||
ICPPTemplateArgument[] args= null;
|
|
||||||
if ((firstBytes & ITypeMarshalBuffer.FLAG2) != 0) {
|
|
||||||
int len= buffer.getInt();
|
|
||||||
args = new ICPPTemplateArgument[len];
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
args[i]= buffer.unmarshalTemplateArgument();
|
|
||||||
}
|
}
|
||||||
|
ICPPTemplateArgument[] args= null;
|
||||||
|
if ((firstBytes & FLAG_HAS_TEMPLATE_ARGS) != 0) {
|
||||||
|
int len= buffer.getInt();
|
||||||
|
args = new ICPPTemplateArgument[len];
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
args[i]= buffer.unmarshalTemplateArgument();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IType impliedObjectType= buffer.unmarshalType();
|
||||||
|
IBinding templateDefinition= buffer.unmarshalBinding();
|
||||||
|
return new EvalFunctionSet(new CPPFunctionSet(bindings, args, null), addressOf, impliedObjectType, templateDefinition);
|
||||||
|
} else {
|
||||||
|
char[] name = buffer.getCharArray();
|
||||||
|
IBinding templateDefinition= buffer.unmarshalBinding();
|
||||||
|
return new EvalFunctionSet(name, addressOf, templateDefinition);
|
||||||
}
|
}
|
||||||
IType impliedObjectType= buffer.unmarshalType();
|
|
||||||
IBinding templateDefinition= buffer.unmarshalBinding();
|
|
||||||
return new EvalFunctionSet(new CPPFunctionSet(bindings, args, null), addressOf, impliedObjectType, templateDefinition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
public ICPPEvaluation instantiate(ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
ICPPClassSpecialization within, int maxdepth, IASTNode point) {
|
||||||
|
if (fFunctionSet == null)
|
||||||
|
return this;
|
||||||
|
|
||||||
ICPPTemplateArgument[] originalArguments = fFunctionSet.getTemplateArguments();
|
ICPPTemplateArgument[] originalArguments = fFunctionSet.getTemplateArguments();
|
||||||
ICPPTemplateArgument[] arguments = originalArguments;
|
ICPPTemplateArgument[] arguments = originalArguments;
|
||||||
if (originalArguments != null)
|
if (originalArguments != null)
|
||||||
|
@ -211,13 +254,42 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
* succeeded or not
|
* succeeded or not
|
||||||
*/
|
*/
|
||||||
public ICPPEvaluation resolveFunction(ICPPEvaluation[] args, IASTNode point) {
|
public ICPPEvaluation resolveFunction(ICPPEvaluation[] args, IASTNode point) {
|
||||||
ICPPFunction[] functions = fFunctionSet.getBindings();
|
// Set up the LookupData.
|
||||||
LookupData data = new LookupData(functions[0].getNameCharArray(),
|
LookupData data;
|
||||||
fFunctionSet.getTemplateArguments(), point);
|
ICPPFunction[] functions = null;
|
||||||
|
if (fFunctionSet == null) {
|
||||||
|
data = new LookupData(fName, null, point);
|
||||||
|
} else {
|
||||||
|
functions = fFunctionSet.getBindings();
|
||||||
|
data = new LookupData(functions[0].getNameCharArray(),
|
||||||
|
fFunctionSet.getTemplateArguments(), point);
|
||||||
|
data.foundItems = functions;
|
||||||
|
}
|
||||||
data.setFunctionArguments(false, args);
|
data.setFunctionArguments(false, args);
|
||||||
if (fImpliedObjectType != null)
|
if (fImpliedObjectType != null)
|
||||||
data.setImpliedObjectType(fImpliedObjectType);
|
data.setImpliedObjectType(fImpliedObjectType);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Perform ADL if appropriate.
|
||||||
|
if (fImpliedObjectType == null && !data.hasTypeOrMemberFunctionOrVariableResult()) {
|
||||||
|
CPPSemantics.doKoenigLookup(data);
|
||||||
|
|
||||||
|
Object[] foundItems = (Object[]) data.foundItems;
|
||||||
|
if (foundItems != null && (functions == null || foundItems.length > functions.length)) {
|
||||||
|
// ADL found additional functions.
|
||||||
|
functions = Arrays.copyOf(foundItems, foundItems.length, ICPPFunction[].class);
|
||||||
|
|
||||||
|
// doKoenigLookup() may introduce duplicates into the result. These must be
|
||||||
|
// eliminated to avoid resolveFunction() reporting an ambiguity. (Normally, when
|
||||||
|
// looukp() and doKoenigLookup() are called on the same LookupData object, the
|
||||||
|
// two functions coordinate using data stored in that object to eliminate
|
||||||
|
// duplicates, but in this case lookup() was called before with a different
|
||||||
|
// LookupData object and now we are only calling doKoenigLookup()).
|
||||||
|
functions = ArrayUtil.removeDuplicates(functions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform template instantiation and overload resolution.
|
||||||
IBinding binding = CPPSemantics.resolveFunction(data, functions, true);
|
IBinding binding = CPPSemantics.resolveFunction(data, functions, true);
|
||||||
if (binding instanceof ICPPFunction && !(binding instanceof ICPPUnknownBinding))
|
if (binding instanceof ICPPFunction && !(binding instanceof ICPPUnknownBinding))
|
||||||
return new EvalBinding(binding, null, getTemplateDefinition());
|
return new EvalBinding(binding, null, getTemplateDefinition());
|
||||||
|
@ -230,9 +302,11 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
|
||||||
@Override
|
@Override
|
||||||
public int determinePackSize(ICPPTemplateParameterMap tpMap) {
|
public int determinePackSize(ICPPTemplateParameterMap tpMap) {
|
||||||
int r = CPPTemplates.PACK_SIZE_NOT_FOUND;
|
int r = CPPTemplates.PACK_SIZE_NOT_FOUND;
|
||||||
ICPPTemplateArgument[] templateArguments = fFunctionSet.getTemplateArguments();
|
if (fFunctionSet != null) {
|
||||||
for (ICPPTemplateArgument arg : templateArguments) {
|
ICPPTemplateArgument[] templateArguments = fFunctionSet.getTemplateArguments();
|
||||||
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(arg, tpMap));
|
for (ICPPTemplateArgument arg : templateArguments) {
|
||||||
|
r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(arg, tpMap));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,10 +206,13 @@ public class EvalID extends CPPDependentEvaluation {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding instanceof CPPDeferredFunction) {
|
if (binding instanceof CPPDeferredFunction) {
|
||||||
CPPDeferredFunction deferredFunction = (CPPDeferredFunction) binding;
|
ICPPFunction[] candidates = ((CPPDeferredFunction) binding).getCandidates();
|
||||||
if (deferredFunction.getCandidates() != null) {
|
if (candidates != null) {
|
||||||
CPPFunctionSet functionSet = new CPPFunctionSet(deferredFunction.getCandidates(), templateArgs, null);
|
CPPFunctionSet functionSet = new CPPFunctionSet(candidates, templateArgs, null);
|
||||||
return new EvalFunctionSet(functionSet, isAddressOf(expr), null, expr);
|
return new EvalFunctionSet(functionSet, isAddressOf(expr), null, expr);
|
||||||
|
} else {
|
||||||
|
// Just store the name. ADL at the time of instantiation might come up with bindings.
|
||||||
|
return new EvalFunctionSet(name.getSimpleID(), isAddressOf(expr), expr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -472,12 +472,6 @@ public class LookupData extends ScopeLookupData {
|
||||||
public void setFunctionArguments(boolean containsImpliedObject, ICPPEvaluation... exprs) {
|
public void setFunctionArguments(boolean containsImpliedObject, ICPPEvaluation... exprs) {
|
||||||
argsContainImpliedObject= containsImpliedObject;
|
argsContainImpliedObject= containsImpliedObject;
|
||||||
functionArgs= exprs;
|
functionArgs= exprs;
|
||||||
for (ICPPEvaluation e : exprs) {
|
|
||||||
if (e.isTypeDependent()) {
|
|
||||||
setIgnorePointOfDeclaration(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFunctionArguments(boolean containsImpliedObject, IASTInitializerClause... exprs) {
|
public void setFunctionArguments(boolean containsImpliedObject, IASTInitializerClause... exprs) {
|
||||||
|
|
|
@ -330,15 +330,17 @@ public class CPPCompositesFactory extends AbstractCompositeFactory {
|
||||||
if (eval instanceof EvalFunctionSet) {
|
if (eval instanceof EvalFunctionSet) {
|
||||||
EvalFunctionSet e= (EvalFunctionSet) eval;
|
EvalFunctionSet e= (EvalFunctionSet) eval;
|
||||||
final CPPFunctionSet fset = e.getFunctionSet();
|
final CPPFunctionSet fset = e.getFunctionSet();
|
||||||
ICPPFunction[] a = fset.getBindings();
|
if (fset != null) {
|
||||||
ICPPTemplateArgument[] b = fset.getTemplateArguments();
|
ICPPFunction[] a = fset.getBindings();
|
||||||
IType c = e.getImpliedObjectType();
|
ICPPTemplateArgument[] b = fset.getTemplateArguments();
|
||||||
|
IType c = e.getImpliedObjectType();
|
||||||
ICPPFunction[] a2 = getCompositeFunctionArray(a);
|
|
||||||
ICPPTemplateArgument[] b2 = TemplateInstanceUtil.convert(this, b);
|
ICPPFunction[] a2 = getCompositeFunctionArray(a);
|
||||||
IType c2 = getCompositeType(c);
|
ICPPTemplateArgument[] b2 = TemplateInstanceUtil.convert(this, b);
|
||||||
if (a != a2 || b != b2 || c != c2 || templateDefinition != templateDefinition2)
|
IType c2 = getCompositeType(c);
|
||||||
e= new EvalFunctionSet(new CPPFunctionSet(a2, b2, null), e.isAddressOf(), c2, templateDefinition2);
|
if (a != a2 || b != b2 || c != c2 || templateDefinition != templateDefinition2)
|
||||||
|
e= new EvalFunctionSet(new CPPFunctionSet(a2, b2, null), e.isAddressOf(), c2, templateDefinition2);
|
||||||
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
if (eval instanceof EvalID) {
|
if (eval instanceof EvalID) {
|
||||||
|
|
|
@ -235,10 +235,11 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
* 141.0 - Storing enclosing template bindings for evaluations, bug 399829.
|
* 141.0 - Storing enclosing template bindings for evaluations, bug 399829.
|
||||||
* 142.0 - Changed marshalling of evaluations to allow more than 15 evaluation kinds, bug 401479.
|
* 142.0 - Changed marshalling of evaluations to allow more than 15 evaluation kinds, bug 401479.
|
||||||
* 143.0 - Store implied object type in EvalFunctionSet, bug 402409.
|
* 143.0 - Store implied object type in EvalFunctionSet, bug 402409.
|
||||||
|
* 144.0 - Add support for storing function sets with zero functions in EvalFunctionSet, bug 402498.
|
||||||
*/
|
*/
|
||||||
private static final int MIN_SUPPORTED_VERSION= version(143, 0);
|
private static final int MIN_SUPPORTED_VERSION= version(144, 0);
|
||||||
private static final int MAX_SUPPORTED_VERSION= version(143, Short.MAX_VALUE);
|
private static final int MAX_SUPPORTED_VERSION= version(144, Short.MAX_VALUE);
|
||||||
private static final int DEFAULT_VERSION = version(143, 0);
|
private static final int DEFAULT_VERSION = version(144, 0);
|
||||||
|
|
||||||
private static int version(int major, int minor) {
|
private static int version(int major, int minor) {
|
||||||
return (major << 16) + minor;
|
return (major << 16) + minor;
|
||||||
|
|
Loading…
Add table
Reference in a new issue