mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Defer resolving function set if target is deferred class or constructor
This commit is contained in:
parent
a89ce59df2
commit
c69eed48e3
2 changed files with 48 additions and 0 deletions
|
@ -11493,4 +11493,42 @@ public class AST2TemplateTests extends AST2CPPTestBase {
|
||||||
public void testBinaryExpressionWithVariableTemplate_bug497931_comment8() throws Exception {
|
public void testBinaryExpressionWithVariableTemplate_bug497931_comment8() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T>
|
||||||
|
// static T* return_self (T *self);
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// struct boolean_option_def
|
||||||
|
// {
|
||||||
|
// boolean_option_def (bool *(*callback) (T *));
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T> struct S {
|
||||||
|
// boolean_option_def<T> def;
|
||||||
|
//
|
||||||
|
// S() : def(return_self) {}
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// S<bool> bool_s_test;
|
||||||
|
public void testResolveFunctionTemplateInDeferredClassArg() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
|
|
||||||
|
// template<typename T>
|
||||||
|
// static T* return_self (T *self);
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// struct boolean_option_def
|
||||||
|
// {
|
||||||
|
// boolean_option_def (bool *(*callback) (T *));
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T> struct S : public boolean_option_def<T> {
|
||||||
|
// S() : boolean_option_def<T>(return_self) {}
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// S<bool> bool_s_test;
|
||||||
|
public void testResolveFunctionTemplateInDeferredBaseArg() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDeferredFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionInstance;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionInstance;
|
||||||
|
@ -3344,6 +3345,15 @@ public class CPPSemantics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cannot resolve if target is deferred template instance or deferred constructor
|
||||||
|
if (targetType instanceof ICPPUnknownBinding || (prop == ICPPASTConstructorInitializer.ARGUMENT
|
||||||
|
&& parent instanceof ICPPASTConstructorInitializer init
|
||||||
|
&& init.getParent() instanceof ICPPASTConstructorChainInitializer memInit
|
||||||
|
&& memInit.getMemberInitializerId().resolveBinding() instanceof ICPPDeferredFunction)) {
|
||||||
|
return CPPDeferredFunction.createForCandidates(functionSet.getBindings());
|
||||||
|
}
|
||||||
|
|
||||||
if (targetType == null && parent instanceof ICPPASTExpression && parent instanceof IASTImplicitNameOwner) {
|
if (targetType == null && parent instanceof ICPPASTExpression && parent instanceof IASTImplicitNameOwner) {
|
||||||
// Trigger resolution of overloaded operator, which may resolve the
|
// Trigger resolution of overloaded operator, which may resolve the
|
||||||
// function set.
|
// function set.
|
||||||
|
|
Loading…
Add table
Reference in a new issue