1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 395026 - Name resolution problem with an alias template.

This commit is contained in:
Sergey Prigogin 2012-11-25 13:46:13 -08:00
parent dfd1d0d635
commit 469b2e8b58
2 changed files with 49 additions and 0 deletions

View file

@ -6684,4 +6684,49 @@ public class AST2TemplateTests extends AST2BaseTest {
assertTrue(AliasInt.getScope() instanceof ICPPTemplateScope); assertTrue(AliasInt.getScope() instanceof ICPPTemplateScope);
} }
// template<typename U>
// struct A {
// template<typename V>
// struct rebind {
// typedef A<V> other;
// };
// };
//
// template<typename T, typename U>
// struct B {
// typedef typename T::template rebind<U>::other type1;
// };
//
// template<typename T>
// struct C {
// template<typename U>
// using rebind2 = typename B<T, U>::type1;
// };
//
// template<typename T>
// struct D : C<T> {
// typedef int type0;
//
// template<typename U>
// struct rebind {
// typedef typename C<T>::template rebind2<U> other2;
// };
// };
//
// template<typename T>
// struct E {
// typedef typename D<T>::template rebind<int>::other2 type2;
// typedef D<type2> type3;
// typedef typename type3::type0 type;
// };
//
// void f(int x);
//
// void test(E<A<int>>::type v) {
// f(v);
// }
public void testAliasTemplate_395026() throws Exception {
parseAndCheckBindings();
}
} }

View file

@ -827,6 +827,10 @@ public class CPPTemplates {
} else if (decl instanceof ITypedef) { } else if (decl instanceof ITypedef) {
IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point); IType type= instantiateType(((ITypedef) decl).getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type); spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
} else if (decl instanceof ICPPAliasTemplate) {
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
IType type= instantiateType(aliasTemplate.getType(), tpMap, -1, getSpecializationContext(owner), point);
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), type, aliasTemplate);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) { } else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter. // TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
spec = decl; spec = decl;