mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-24 16:53:50 +02:00
Partial fix for bug 229917.
This commit is contained in:
parent
7f19b400e8
commit
b0849e06bf
3 changed files with 570 additions and 550 deletions
|
@ -2038,12 +2038,28 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
// int main(map<int, int> x) {
|
// int main(map<int, int> x) {
|
||||||
// GetPair(x, 1);
|
// GetPair(x, 1);
|
||||||
// }
|
// }
|
||||||
public void _testBug229917() throws Exception {
|
public void testBug229917_1() throws Exception {
|
||||||
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||||
IBinding b0 = bh.assertNonProblem("_C::value_type GetPair", 2, IBinding.class);
|
|
||||||
ICPPFunction fn = bh.assertNonProblem("GetPair(x", 7, ICPPFunction.class);
|
ICPPFunction fn = bh.assertNonProblem("GetPair(x", 7, ICPPFunction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<class _T1, class _T2>
|
||||||
|
// struct pair {
|
||||||
|
// typedef _T1 first_type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename _Key, typename _Tp>
|
||||||
|
// struct map {
|
||||||
|
// typedef pair<_Key, _Tp> value_type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <class _C>
|
||||||
|
// typename _C::value_type GetPair(_C& collection, typename _C::value_type::first_type key);
|
||||||
|
public void _testBug229917_2() throws Exception {
|
||||||
|
BindingAssertionHelper bh= new BindingAssertionHelper(getAboveComment(), true);
|
||||||
|
IBinding b0 = bh.assertNonProblem("value_type GetPair", 10, IBinding.class);
|
||||||
|
}
|
||||||
|
|
||||||
// class A {};
|
// class A {};
|
||||||
//
|
//
|
||||||
// template <class T> class C {
|
// template <class T> class C {
|
||||||
|
|
|
@ -1562,7 +1562,9 @@ public class CPPSemantics {
|
||||||
|
|
||||||
final boolean indexBased= data.tu != null && data.tu.getIndex() != null;
|
final boolean indexBased= data.tu != null && data.tu.getIndex() != null;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ObjectSet<IFunction> fns= ObjectSet.EMPTY_SET, templateFns= ObjectSet.EMPTY_SET;
|
ObjectSet<IFunction> fns= ObjectSet.EMPTY_SET;
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
ObjectSet<IFunction> templateFns= ObjectSet.EMPTY_SET;
|
||||||
IBinding type = null;
|
IBinding type = null;
|
||||||
IBinding obj = null;
|
IBinding obj = null;
|
||||||
IBinding temp = null;
|
IBinding temp = null;
|
||||||
|
|
|
@ -1223,6 +1223,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public boolean deduceTemplateArgument(ObjectMap map, IType p, IType a) throws DOMException {
|
static public boolean deduceTemplateArgument(ObjectMap map, IType p, IType a) throws DOMException {
|
||||||
boolean pIsAReferenceType = (p instanceof ICPPReferenceType);
|
boolean pIsAReferenceType = (p instanceof ICPPReferenceType);
|
||||||
p = getParameterTypeForDeduction(p);
|
p = getParameterTypeForDeduction(p);
|
||||||
|
@ -1308,6 +1309,8 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (p instanceof ICPPInternalUnknown) {
|
||||||
|
return true; // An unknown type may match anything.
|
||||||
} else {
|
} else {
|
||||||
return p.isSameType(a);
|
return p.isSameType(a);
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1333,6 @@ public class CPPTemplates {
|
||||||
* for each occurrence of that parameter in the function parameter list
|
* for each occurrence of that parameter in the function parameter list
|
||||||
* @throws DOMException
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static private IType[] createArgsForFunctionTemplateOrdering(ICPPFunctionTemplate template) throws DOMException{
|
static private IType[] createArgsForFunctionTemplateOrdering(ICPPFunctionTemplate template) throws DOMException{
|
||||||
ICPPTemplateParameter[] paramList = template.getTemplateParameters();
|
ICPPTemplateParameter[] paramList = template.getTemplateParameters();
|
||||||
int size = paramList.length;
|
int size = paramList.length;
|
||||||
|
|
Loading…
Add table
Reference in a new issue