Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2011-07-04 04:10:54 -0400
committerMarkus Schorn2011-07-04 04:16:25 -0400
commitf50bbd18197cdc69a36a7b36169708e7d21699e5 (patch)
treeb165c7595579bdcc0ec59d6598bea8f9907d195a /core
parentfa9ba41575574c1e78b6b4519eff27363a4fe5e3 (diff)
downloadorg.eclipse.cdt-f50bbd18197cdc69a36a7b36169708e7d21699e5.tar.gz
org.eclipse.cdt-f50bbd18197cdc69a36a7b36169708e7d21699e5.tar.xz
org.eclipse.cdt-f50bbd18197cdc69a36a7b36169708e7d21699e5.zip
Bug 350345: Typedef as class name for ctor with overloaded function pointer argument.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPSemantics.java12
2 files changed, 22 insertions, 7 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 81d470ebc7..c017eb25d0 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
@@ -9435,5 +9435,20 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(ctor instanceof ICPPConstructor);
assertEquals(1, ((ICPPConstructor) ctor).getType().getParameterTypes().length);
}
-
+
+ // struct Foo {
+ // void Method(int) {}
+ // void Method() const {}
+ // };
+ // template<typename Arg> struct Callback {
+ // Callback(void (Foo::*function)(Arg arg)) {
+ // }
+ // };
+ // typedef Callback<int> MyCallback;
+ // void xx() {
+ // MyCallback x= MyCallback(&Foo::Method); // Invalid overload of 'Foo::Method'
+ // }
+ public void testTypedefAsClassNameWithFunctionPtrArgument_350345() 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 4d744a4a26..822b794a9c 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
@@ -361,13 +361,13 @@ public class CPPSemantics {
}
}
- if (binding instanceof ICPPClassType) {
- if (convertClassToConstructor(data.astName)) {
- if (binding instanceof IIndexBinding) {
- binding= data.tu.mapToAST((ICPPClassType) binding);
+ if (binding instanceof IType) {
+ IType t = getNestedType((IType) binding, TDEF);
+ if (t instanceof ICPPClassType && convertClassToConstructor(data.astName)) {
+ ICPPClassType cls= (ICPPClassType) t;
+ if (cls instanceof IIndexBinding) {
+ cls= data.tu.mapToAST(cls);
}
- ICPPClassType cls= (ICPPClassType) binding;
-
try {
if (data.astName instanceof ICPPASTTemplateId && cls instanceof ICPPClassTemplate) {
if (data.tu != null) {

Back to the top