mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Bug 431945 - Unresolved template function with typedef.
This commit is contained in:
parent
ed4784c133
commit
535f975b47
2 changed files with 25 additions and 0 deletions
|
@ -1017,6 +1017,19 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertInstance(f, ICPPTemplateInstance.class);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// bool waldo(T* dummy = nullptr);
|
||||
|
||||
// struct A {};
|
||||
//
|
||||
// void test() {
|
||||
// typedef A a;
|
||||
// waldo<a>();
|
||||
// }
|
||||
public void testFunctionTemplateWithTypedef_431945() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// template<typename T>
|
||||
// class Foo {};
|
||||
//
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IValue;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ISerializableEvaluation;
|
||||
|
@ -88,6 +89,17 @@ public final class TypeMarshalBuffer implements ITypeMarshalBuffer {
|
|||
putShort(NULL_TYPE);
|
||||
} else {
|
||||
PDOMNode pb= fLinkage.addTypeBinding(binding);
|
||||
if (pb == null && binding instanceof ITypedef) {
|
||||
// Since typedef defined in a local scope cannot be stored in the index,
|
||||
// store the target type instead.
|
||||
IType type = ((ITypedef) binding).getType();
|
||||
if (type instanceof ISerializableType) {
|
||||
((ISerializableType) type).marshal(this);
|
||||
return;
|
||||
} else if (type instanceof IBinding) {
|
||||
pb = fLinkage.addTypeBinding((IBinding) type);
|
||||
}
|
||||
}
|
||||
if (pb == null) {
|
||||
putShort(UNSTORABLE_TYPE);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue