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:
parent
58ada354ae
commit
c1f5fbcb8f
2 changed files with 23 additions and 0 deletions
|
@ -2542,6 +2542,25 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPFunction fn= bh.assertNonProblem("foo(cx", 3, ICPPFunction.class);
|
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>
|
// template<int x>
|
||||||
// class A {};
|
// class A {};
|
||||||
//
|
//
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.core.parser.util.ObjectSet;
|
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.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
|
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;
|
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 {
|
public static final ICPPMethod[] getDeclaredConversionOperators(ICPPClassType clazz) throws DOMException {
|
||||||
ICPPMethod[] methods= new ICPPMethod[0];
|
ICPPMethod[] methods= new ICPPMethod[0];
|
||||||
|
if (clazz instanceof ICPPDeferredClassInstance) {
|
||||||
|
clazz= (ICPPClassType) ((ICPPDeferredClassInstance)clazz).getTemplateDefinition();
|
||||||
|
}
|
||||||
ICPPMethod[] decs= clazz.getDeclaredMethods();
|
ICPPMethod[] decs= clazz.getDeclaredMethods();
|
||||||
if(decs != null) {
|
if(decs != null) {
|
||||||
for(ICPPMethod method : decs) {
|
for(ICPPMethod method : decs) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue