1
0
Fork 0
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:
Nathan Ridge 2012-12-05 21:18:47 -05:00 committed by Sergey Prigogin
parent d60a5ef6d1
commit ed818d803d
3 changed files with 19 additions and 3 deletions

View file

@ -9958,4 +9958,19 @@ public class AST2CPPTests extends AST2BaseTest {
public void testOrderInAmbiguityResolution_390759() throws Exception {
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();
}
}

View file

@ -268,7 +268,7 @@ public class CPPSemantics {
lookup(data, null);
// Perform argument dependent lookup
if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionResult()) {
if (data.checkAssociatedScopes() && !data.hasTypeOrMemberFunctionOrVariableResult()) {
doKoenigLookup(data);
}
} catch (DOMException e) {

View file

@ -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.ScopeLookupData;
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.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
@ -336,12 +337,12 @@ public class LookupData extends ScopeLookupData {
return false;
}
public boolean hasTypeOrMemberFunctionResult() {
public boolean hasTypeOrMemberFunctionOrVariableResult() {
if (foundItems == null)
return false;
if (foundItems instanceof Object[]) {
for (Object item : (Object[]) foundItems) {
if (item instanceof ICPPMethod || item instanceof IType) {
if (item instanceof ICPPMethod || item instanceof IType || item instanceof IVariable) {
return true;
}
}