1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 14:35:23 +02:00

Bug 442213 - Field reference in pack expansion

Change-Id: Iea4f20ced1050d66aad178d43db0c5dac15faed2
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/32191
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2014-08-23 01:29:28 -04:00 committed by Sergey Prigogin
parent 60290def38
commit 01fcf452a7
2 changed files with 20 additions and 0 deletions

View file

@ -8058,6 +8058,22 @@ public class AST2TemplateTests extends AST2TestBase {
helper.assertProblem("waldo<int>()", "waldo<int>"); helper.assertProblem("waldo<int>()", "waldo<int>");
} }
// // Example 1
// template <typename... T>
// void foo1(T... t) {
// bar(t.waldo...);
// }
//
// // Example 2
// template <typename> struct A {};
// template <typename... T>
// void foo2(A<T>... t) {
// bar(t.waldo...);
// }
public void testMemberAccessInPackExpansion_442213() throws Exception {
parseAndCheckBindings();
}
// template <typename T> // template <typename T>
// struct A {}; // struct A {};
// //

View file

@ -157,6 +157,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameterPackType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope; import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
@ -1301,6 +1302,9 @@ public class CPPVisitor extends ASTQueries {
final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference) parent; final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference) parent;
IType type = fieldReference.getFieldOwnerType(); IType type = fieldReference.getFieldOwnerType();
type= getUltimateTypeUptoPointers(type); type= getUltimateTypeUptoPointers(type);
if (type instanceof ICPPParameterPackType) {
type = ((ICPPParameterPackType) type).getType();
}
if (type instanceof ICPPClassType) { if (type instanceof ICPPClassType) {
type= SemanticUtil.mapToAST(type, fieldReference); type= SemanticUtil.mapToAST(type, fieldReference);
return ((ICPPClassType) type).getCompositeScope(); return ((ICPPClassType) type).getCompositeScope();