1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 484200 - Point of declaration of an alias or alias template

Change-Id: I068b5fd4cf7ae4458e515a5c26265f30abaf9ad8
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
This commit is contained in:
Nathan Ridge 2015-12-15 18:03:13 -05:00 committed by Sergey Prigogin
parent 393d36fc3e
commit 6c750f9289
2 changed files with 18 additions and 0 deletions

View file

@ -11751,4 +11751,17 @@ public class AST2CPPTests extends AST2TestBase {
assertEquals(1, implicitNames.length);
assertEquals(ctor, implicitNames[0].resolveBinding());
}
// template <typename T>
// struct Waldo {
// T x;
// };
//
// void test() {
// using Waldo = Waldo<int>;
// auto size = sizeof(Waldo::x);
// }
public void testShadowingAliasDeclaration_484200() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -1967,6 +1967,11 @@ public class CPPSemantics {
} else if (prop == ICPPASTNamespaceAlias.ALIAS_NAME) {
nd = (ASTNode) nd.getParent();
pointOfDecl = nd.getOffset() + nd.getLength();
} else if (prop == ICPPASTAliasDeclaration.ALIAS_NAME) {
// [basic.scope.pdecl]/p3: The point of declaration of an alias or alias template
// immediately follows the type-id to which the alias refers.
ASTNode targetType = (ASTNode) ((ICPPASTAliasDeclaration) nd.getParent()).getMappingTypeId();
pointOfDecl = targetType.getOffset() + targetType.getLength();
} else if (prop == ICPPASTSimpleTypeTemplateParameter.PARAMETER_NAME
|| prop == ICPPASTTemplatedTypeTemplateParameter.PARAMETER_NAME) {
// [basic.scope.pdecl]/p9: The point of declaration for a template parameter