1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

226231: apply fix

This commit is contained in:
Andrew Ferguson 2008-04-09 14:08:56 +00:00
parent 887a1ea83e
commit fa65eafa16
2 changed files with 36 additions and 8 deletions

View file

@ -2256,7 +2256,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// bar(ca); // bar(ca);
// } // }
public void testBug214646() throws Exception { 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 b0= bh.assertNonProblem("foo(a)", 3);
IBinding b1= bh.assertNonProblem("bar(ca)", 3); IBinding b1= bh.assertNonProblem("bar(ca)", 3);
@ -2292,7 +2292,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// foo(d); // foo(d);
// } // }
public void testUserDefinedConversions_224364() throws Exception { 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); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class);
} }
@ -2312,7 +2312,7 @@ public class AST2TemplateTests extends AST2BaseTest {
// foo(d); // foo(d);
// } // }
public void testUserDefinedConversions_224364_2() throws Exception { 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); ICPPFunction fn= bh.assertNonProblem("foo(d)", 3, ICPPFunction.class);
} }
@ -2335,7 +2335,31 @@ public class AST2TemplateTests extends AST2BaseTest {
// //
// Z z= foo(*new E<Z>()); // Z z= foo(*new E<Z>());
public void testUserDefinedConversions_224364_3() throws Exception { 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); ICPPFunction fn= bh.assertNonProblem("foo(*new", 3, ICPPFunction.class);
} }
// class X {}; class B {};
// template<typename T>
// class C {
// public:
// T t;
// operator T() {return t;}
// };
// template<>
// class C<X> {
// public:
// X t;
// operator B() {B b; return b;}
// };
// void foo(B b) {}
//
// void refs() {
// C<X> cx;
// foo(cx);
// }
public void testUserDefinedConversions_226231() throws Exception {
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
ICPPFunction fn= bh.assertNonProblem("foo(cx", 3, ICPPFunction.class);
}
} }

View file

@ -48,7 +48,7 @@ import org.eclipse.cdt.internal.core.index.IIndexType;
* *
*/ */
public class CPPClassSpecialization extends CPPSpecialization implements public class CPPClassSpecialization extends CPPSpecialization implements
ICPPClassType, ICPPInternalBinding { ICPPClassType {
private IScope specScope; private IScope specScope;
@ -157,9 +157,13 @@ public class CPPClassSpecialization extends CPPSpecialization implements
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getDeclaredMethods() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getDeclaredMethods()
*/ */
public ICPPMethod[] getDeclaredMethods() throws DOMException { public ICPPMethod[] getDeclaredMethods() throws DOMException {
CPPClassSpecializationScope scope = (CPPClassSpecializationScope) getCompositeScope(); IScope scope= getCompositeScope();
if (scope.isFullyCached()) if (scope instanceof CPPClassSpecializationScope) {
return scope.getDeclaredMethods(); CPPClassSpecializationScope sscope= (CPPClassSpecializationScope) scope;
if (sscope.isFullyCached())
return sscope.getDeclaredMethods();
}
IBinding binding = null; IBinding binding = null;
ICPPMethod [] result = null; ICPPMethod [] result = null;