From fa65eafa16a2e94d480a91e08f1aaf38d6bf5a39 Mon Sep 17 00:00:00 2001 From: Andrew Ferguson Date: Wed, 9 Apr 2008 14:08:56 +0000 Subject: [PATCH] 226231: apply fix --- .../parser/tests/ast2/AST2TemplateTests.java | 32 ++++++++++++++++--- .../parser/cpp/CPPClassSpecialization.java | 12 ++++--- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index f2c689e9c7f..74508718300 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -2256,7 +2256,7 @@ public class AST2TemplateTests extends AST2BaseTest { // bar(ca); // } public void testBug214646() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); IBinding b0= bh.assertNonProblem("foo(a)", 3); IBinding b1= bh.assertNonProblem("bar(ca)", 3); @@ -2292,7 +2292,7 @@ public class AST2TemplateTests extends AST2BaseTest { // foo(d); // } public void testUserDefinedConversions_224364() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class); } @@ -2312,7 +2312,7 @@ public class AST2TemplateTests extends AST2BaseTest { // foo(d); // } public void testUserDefinedConversions_224364_2() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class); } @@ -2335,7 +2335,31 @@ public class AST2TemplateTests extends AST2BaseTest { // // Z z= foo(*new E()); public void testUserDefinedConversions_224364_3() throws Exception { - BindingAssertionHelper bh= new BindingAssertionHelper(getContents(1)[0].toString(), true); + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); ICPPFunction fn= bh.assertNonProblem("foo(*new", 3, ICPPFunction.class); } + + // class X {}; class B {}; + // template + // class C { + // public: + // T t; + // operator T() {return t;} + // }; + // template<> + // class C { + // public: + // X t; + // operator B() {B b; return b;} + // }; + // void foo(B b) {} + // + // void refs() { + // C cx; + // foo(cx); + // } + public void testUserDefinedConversions_226231() throws Exception { + BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true); + ICPPFunction fn= bh.assertNonProblem("foo(cx", 3, ICPPFunction.class); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java index ffca78ec97c..3cca41cd637 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassSpecialization.java @@ -48,7 +48,7 @@ import org.eclipse.cdt.internal.core.index.IIndexType; * */ public class CPPClassSpecialization extends CPPSpecialization implements - ICPPClassType, ICPPInternalBinding { + ICPPClassType { private IScope specScope; @@ -157,9 +157,13 @@ public class CPPClassSpecialization extends CPPSpecialization implements * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getDeclaredMethods() */ public ICPPMethod[] getDeclaredMethods() throws DOMException { - CPPClassSpecializationScope scope = (CPPClassSpecializationScope) getCompositeScope(); - if (scope.isFullyCached()) - return scope.getDeclaredMethods(); + IScope scope= getCompositeScope(); + if (scope instanceof CPPClassSpecializationScope) { + CPPClassSpecializationScope sscope= (CPPClassSpecializationScope) scope; + if (sscope.isFullyCached()) + return sscope.getDeclaredMethods(); + } + IBinding binding = null; ICPPMethod [] result = null;