Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2014-08-23 05:29:28 +0000
committerSergey Prigogin2014-08-27 21:42:10 +0000
commit01fcf452a79ae3bbd9253059e868d3d05f1e6c55 (patch)
treed24a3bd224151ba17f697b6c248c44676bfdab38
parent60290def38c61da8393b3bcf78d8784baca8b04e (diff)
downloadorg.eclipse.cdt-01fcf452a79ae3bbd9253059e868d3d05f1e6c55.tar.gz
org.eclipse.cdt-01fcf452a79ae3bbd9253059e868d3d05f1e6c55.tar.xz
org.eclipse.cdt-01fcf452a79ae3bbd9253059e868d3d05f1e6c55.zip
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>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java4
2 files changed, 20 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
index 31e3a6fa056..3800641a7ba 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java
@@ -8057,6 +8057,22 @@ public class AST2TemplateTests extends AST2TestBase {
BindingAssertionHelper helper = getAssertionHelper();
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>
// struct A {};
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 1016dedc967..d538c4eb500 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -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.ICPPNamespaceAlias;
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.ICPPScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
@@ -1301,6 +1302,9 @@ public class CPPVisitor extends ASTQueries {
final ICPPASTFieldReference fieldReference = (ICPPASTFieldReference) parent;
IType type = fieldReference.getFieldOwnerType();
type= getUltimateTypeUptoPointers(type);
+ if (type instanceof ICPPParameterPackType) {
+ type = ((ICPPParameterPackType) type).getType();
+ }
if (type instanceof ICPPClassType) {
type= SemanticUtil.mapToAST(type, fieldReference);
return ((ICPPClassType) type).getCompositeScope();

Back to the top