mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 388287 - False ambiguity in overload resolution with function
objects Change-Id: If7447f6c73e9f03e31cf0f292c4a9e73591e1936 Reviewed-on: https://git.eclipse.org/r/9055 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
d60a5ef6d1
commit
ed818d803d
3 changed files with 19 additions and 3 deletions
|
@ -9958,4 +9958,19 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
public void testOrderInAmbiguityResolution_390759() throws Exception {
|
public void testOrderInAmbiguityResolution_390759() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// namespace N {
|
||||||
|
// enum E { A, B };
|
||||||
|
// void bar(E);
|
||||||
|
// }
|
||||||
|
// struct S {
|
||||||
|
// void operator()(N::E);
|
||||||
|
// };
|
||||||
|
// S bar;
|
||||||
|
// int main() {
|
||||||
|
// bar(N::A);
|
||||||
|
// }
|
||||||
|
public void testADLForFunctionObject_388287() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ public class CPPSemantics {
|
||||||
lookup(data, null);
|
lookup(data, null);
|
||||||
|
|
||||||
// Perform argument dependent lookup
|
// Perform argument dependent lookup
|
||||||
if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionResult()) {
|
if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionOrVariableResult()) {
|
||||||
doKoenigLookup(data);
|
doKoenigLookup(data);
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope.ScopeLookupData;
|
import org.eclipse.cdt.core.dom.ast.IScope.ScopeLookupData;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
@ -336,12 +337,12 @@ public class LookupData extends ScopeLookupData {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasTypeOrMemberFunctionResult() {
|
public boolean hasTypeOrMemberFunctionOrVariableResult() {
|
||||||
if (foundItems == null)
|
if (foundItems == null)
|
||||||
return false;
|
return false;
|
||||||
if (foundItems instanceof Object[]) {
|
if (foundItems instanceof Object[]) {
|
||||||
for (Object item : (Object[]) foundItems) {
|
for (Object item : (Object[]) foundItems) {
|
||||||
if (item instanceof ICPPMethod || item instanceof IType) {
|
if (item instanceof ICPPMethod || item instanceof IType || item instanceof IVariable) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue