mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 00:36:16 +02:00
Bug 507511 - Template function resolution problem when using index
Change-Id: I7e75a188f8902c6b21f2c96660cc68fcebfdd0db
This commit is contained in:
parent
88b2f8564a
commit
08eb54b46d
2 changed files with 43 additions and 1 deletions
|
@ -1182,6 +1182,45 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
|||
assertEquals("int", ASTTypeUtil.getType(type));
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct D;
|
||||
//
|
||||
// template <typename C, typename U>
|
||||
// struct D<void (C::*)(U)> {
|
||||
// typedef U type;
|
||||
// };
|
||||
//
|
||||
// template <typename T>
|
||||
// using E = typename D<decltype(&T::operator())>::type;
|
||||
//
|
||||
// template <typename T>
|
||||
// struct G {
|
||||
// typedef E<T> type;
|
||||
// };
|
||||
//
|
||||
// template <typename T>
|
||||
// using F = typename G<T>::type;
|
||||
//
|
||||
// template <typename T, typename U>
|
||||
// struct B {};
|
||||
//
|
||||
// template <typename T>
|
||||
// B<F<T>, int>* f(T t);
|
||||
//
|
||||
// template <typename U>
|
||||
// void waldo(B<double, U>* e);
|
||||
|
||||
// struct A {
|
||||
// void operator()(double x);
|
||||
// };
|
||||
//
|
||||
// void test() {
|
||||
// waldo(f(A()));
|
||||
// }
|
||||
public void testTemplateArgumentDeduction_507511() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// class A {}; class B {}; class X {};
|
||||
// template<typename T>
|
||||
// class C {
|
||||
|
|
|
@ -836,7 +836,10 @@ public class TemplateArgumentDeduction {
|
|||
return tval.equals(sval);
|
||||
}
|
||||
|
||||
return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point);
|
||||
// Try to deduce from the original argument type, but if it fails, fall back to the simplified
|
||||
// argument type.
|
||||
return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point)
|
||||
|| fromType(p.getTypeValue(), a.getTypeValue(), false, point);
|
||||
}
|
||||
|
||||
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {
|
||||
|
|
Loading…
Add table
Reference in a new issue