Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-11-20 06:44:08 +0000
committerNathan Ridge2018-11-27 05:47:56 +0000
commit2f678054ff004cddbffebd0598eb4ff5bb297d3a (patch)
treea5df2c5f3a133bc65a110ee461d729953af4c05d
parentafc2bbaa6297466665caf5fad5e812da2f96cb0e (diff)
downloadorg.eclipse.cdt-2f678054ff004cddbffebd0598eb4ff5bb297d3a.tar.gz
org.eclipse.cdt-2f678054ff004cddbffebd0598eb4ff5bb297d3a.tar.xz
org.eclipse.cdt-2f678054ff004cddbffebd0598eb4ff5bb297d3a.zip
Bug 540741 - Parameter pack in argument of alias template instance that's not present in the target type
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java9
2 files changed, 29 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 42e967458c5..c5cc8440506 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
@@ -11075,4 +11075,24 @@ public class AST2TemplateTests extends AST2CPPTestBase {
BindingAssertionHelper bh = new AST2AssertionHelper(getAboveComment(), CPP);
bh.assertProblem("B<A>", 4);
}
+
+ // struct my_type {};
+ //
+ // template <class>
+ // using my_type_alias = my_type;
+ //
+ // template <class... Ts>
+ // struct foo {
+ // template <class... Vs>
+ // static int select(my_type_alias<Ts>..., Vs...);
+ //
+ // using type = decltype(select(Ts()...));
+ // };
+ //
+ // template <class> struct trigger{};
+ //
+ // using A = trigger<foo<my_type>::type>;
+ public void testParameterPackInAliasTemplateArgs_540741() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index d894fc5d486..157107f088e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -1238,6 +1238,15 @@ public class CPPTemplates {
}
if (type instanceof ITypeContainer) {
+ if (type instanceof ICPPAliasTemplateInstance) {
+ ICPPTemplateArgument[] args = ((ICPPAliasTemplateInstance) type).getTemplateArguments();
+ for (ICPPTemplateArgument arg : args) {
+ r = combinePackSize(r, determinePackSize(arg, tpMap));
+ if (r < 0) {
+ return r;
+ }
+ }
+ }
final ITypeContainer typeContainer = (ITypeContainer) type;
r = combinePackSize(r, determinePackSize(typeContainer.getType(), tpMap));
}

Back to the top