mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Yet another typedef preservation fix.
This commit is contained in:
parent
c0903d7ad9
commit
06ef676a2b
3 changed files with 23 additions and 3 deletions
|
@ -4816,8 +4816,26 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
// template <typename T> class char_traits {};
|
// template <typename T> class char_traits {};
|
||||||
// template <typename C, typename T = char_traits<C>> class basic_string {};
|
// template <typename C, typename T = char_traits<C>> class basic_string {};
|
||||||
//
|
//
|
||||||
|
// template<typename _Iterator>
|
||||||
|
// struct iterator_traits {
|
||||||
|
// typedef typename _Iterator::reference reference;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Tp>
|
||||||
|
// struct iterator_traits<_Tp*> {
|
||||||
|
// typedef _Tp& reference;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename _Iterator, typename _Container>
|
||||||
|
// struct normal_iterator {
|
||||||
|
// typedef iterator_traits<_Iterator> traits_type;
|
||||||
|
// typedef typename traits_type::reference reference;
|
||||||
|
// reference operator*() const;
|
||||||
|
// };
|
||||||
|
//
|
||||||
// template <typename T> struct vector {
|
// template <typename T> struct vector {
|
||||||
// typedef T* iterator;
|
// typedef T* pointer;
|
||||||
|
// typedef normal_iterator<pointer, vector> iterator;
|
||||||
// iterator begin();
|
// iterator begin();
|
||||||
// iterator end();
|
// iterator end();
|
||||||
// };
|
// };
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class CPPTemplateTypeArgument implements ICPPTemplateArgument {
|
||||||
|
|
||||||
public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {
|
public CPPTemplateTypeArgument(IType simplifiedType, IType originalType) {
|
||||||
Assert.isNotNull(simplifiedType);
|
Assert.isNotNull(simplifiedType);
|
||||||
|
Assert.isNotNull(originalType);
|
||||||
fType= simplifiedType;
|
fType= simplifiedType;
|
||||||
fOriginalType= originalType;
|
fOriginalType= originalType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,11 +678,12 @@ public class TemplateArgumentDeduction {
|
||||||
return tval.equals(sval);
|
return tval.equals(sval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromType(p.getTypeValue(), a.getTypeValue(), false, point);
|
return fromType(p.getTypeValue(), a.getOriginalTypeValue(), false, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {
|
private boolean fromType(IType p, IType a, boolean allowCVQConversion, IASTNode point) throws DOMException {
|
||||||
while (p != null) {
|
while (p != null) {
|
||||||
|
IType argyumentTypeBeforeTypedefResolution = a;
|
||||||
while (a instanceof ITypedef)
|
while (a instanceof ITypedef)
|
||||||
a = ((ITypedef) a).getType();
|
a = ((ITypedef) a).getType();
|
||||||
if (p instanceof IBasicType) {
|
if (p instanceof IBasicType) {
|
||||||
|
@ -775,7 +776,7 @@ public class TemplateArgumentDeduction {
|
||||||
}
|
}
|
||||||
if (a == null)
|
if (a == null)
|
||||||
return false;
|
return false;
|
||||||
return deduce(((ICPPTemplateParameter)p).getParameterID(), new CPPTemplateTypeArgument(a));
|
return deduce(((ICPPTemplateParameter) p).getParameterID(), new CPPTemplateTypeArgument(a, argyumentTypeBeforeTypedefResolution));
|
||||||
} else if (p instanceof ICPPTemplateInstance) {
|
} else if (p instanceof ICPPTemplateInstance) {
|
||||||
if (!(a instanceof ICPPTemplateInstance))
|
if (!(a instanceof ICPPTemplateInstance))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue