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

239023: user defined operator lookup on deferred class type

This commit is contained in:
Andrew Ferguson 2008-06-30 17:13:40 +00:00
parent 58ada354ae
commit c1f5fbcb8f
2 changed files with 23 additions and 0 deletions

View file

@ -2542,6 +2542,25 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPFunction fn= bh.assertNonProblem("foo(cx", 3, ICPPFunction.class);
}
// class A;
//
// int foo(A a);
//
// template <class T>
// class C {
// public:
// inline operator A();
// };
//
// template<typename T>
// void ref(C<T> c) {
// return foo(c);
// }
public void testUserDefinedConversions_239023() throws Exception {
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
ba.assertNonProblem("foo(c);", 3);
}
// template<int x>
// class A {};
//

View file

@ -34,6 +34,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.core.parser.util.ObjectSet;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
/**
@ -63,6 +64,9 @@ public class SemanticUtil {
*/
public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz) throws DOMException {
ICPPMethod[] methods= new ICPPMethod[0];
if (clazz instanceof ICPPDeferredClassInstance) {
clazz= (ICPPClassType) ((ICPPDeferredClassInstance)clazz).getTemplateDefinition();
}
ICPPMethod[] decs= clazz.getDeclaredMethods();
if(decs != null) {
for(ICPPMethod method : decs) {