summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2012-12-05 21:18:47 (EST)
committerSergey Prigogin2012-12-07 14:59:37 (EST)
commited818d803d0fbb89244f82315a8f8f82baeaa2bc (patch)
tree8c13ca70e29d0a81cdacca5933c6977afbca3e22
parentd60a5ef6d112a2824a828cec66fb45bdef2707cf (diff)
downloadorg.eclipse.cdt-ed818d803d0fbb89244f82315a8f8f82baeaa2bc.zip
org.eclipse.cdt-ed818d803d0fbb89244f82315a8f8f82baeaa2bc.tar.gz
org.eclipse.cdt-ed818d803d0fbb89244f82315a8f8f82baeaa2bc.tar.bz2
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>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java5
3 files changed, 19 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 7ed0a30..c58b157 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -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();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
index 1f864db..dec5a06 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java
@@ -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) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
index abf0cde..bb46772 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/LookupData.java
@@ -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;
}
}