1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Bug 488456 - Handle unknown class instance that resolves to alias

template specialization

Change-Id: I8e57ebffb8d93b22948a6822b566988d5b2f91ad
This commit is contained in:
Nathan Ridge 2016-02-25 22:51:53 -05:00 committed by Sergey Prigogin
parent 3a923c84ec
commit 1171bc168c
2 changed files with 25 additions and 1 deletions

View file

@ -7289,6 +7289,22 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings();
}
// template <class>
// struct Traits {
// template <class U>
// using rebind = U;
// };
// template <class T>
// struct Meta {
// typedef typename Traits<T>::template rebind<int> type;
// };
// typedef Meta<int>::type Waldo;
public void testNestedAliasTemplate_488456() throws Exception {
BindingAssertionHelper helper = getAssertionHelper();
ITypedef waldo = helper.assertNonProblem("Waldo");
assertSameType(waldo, CommonCPPTypes.int_);
}
// template<typename U>
// struct A {
// typedef U type1;

View file

@ -2904,7 +2904,9 @@ public class CPPTemplates {
IScope s = ((ICPPClassType) ot1).getCompositeScope();
if (s != null) {
result= CPPSemantics.resolveUnknownName(s, unknown, context.getPoint());
if (unknown instanceof ICPPUnknownMemberClassInstance && result instanceof ICPPTemplateDefinition) {
if (unknown instanceof ICPPUnknownMemberClassInstance &&
(result instanceof ICPPTemplateDefinition ||
result instanceof ICPPAliasTemplateInstance)) {
ICPPTemplateArgument[] args1 = instantiateArguments(
((ICPPUnknownMemberClassInstance) unknown).getArguments(), context, false);
if (result instanceof ICPPClassTemplate) {
@ -2912,6 +2914,12 @@ public class CPPTemplates {
} else if (result instanceof ICPPAliasTemplate) {
result = instantiateAliasTemplate((ICPPAliasTemplate) result, args1,
context.getPoint());
} else if (result instanceof ICPPAliasTemplateInstance) {
// TODO(nathanridge): Remove this branch once we properly represent
// specializations of alias templates (which will then implement
// ICPPAliasTemplate and be caught by the previous branch).
result = instantiateAliasTemplateInstance((ICPPAliasTemplateInstance) result,
args1, context.getPoint());
}
}
}