summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-02-19 03:27:53 (EST)
committer Sergey Prigogin2013-02-20 12:51:30 (EST)
commit24ba7ff6880c98cab8a77144dc1c8f08c8d8db9c (patch)
tree35a4729997e3cd81e5476f3f348f8d584050a0a6
parentee08bee24b2ac0013f876fcb64ef6cebd8e35f4d (diff)
downloadorg.eclipse.cdt-24ba7ff6880c98cab8a77144dc1c8f08c8d8db9c.zip
org.eclipse.cdt-24ba7ff6880c98cab8a77144dc1c8f08c8d8db9c.tar.gz
org.eclipse.cdt-24ba7ff6880c98cab8a77144dc1c8f08c8d8db9c.tar.bz2
Bug 401142 - Error involving variadic non-type template parametersrefs/changes/67/10467/4
Change-Id: I7735649c59354431a91980142055e4b86a82e6f6 Reviewed-on: https://git.eclipse.org/r/10467 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: 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.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java2
2 files changed, 21 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 81fee25..57a89c6 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
@@ -7292,5 +7292,24 @@ public class AST2TemplateTests extends AST2TestBase {
public void testNPE_401140() throws Exception {
BindingAssertionHelper helper = new BindingAssertionHelper(getAboveComment(), true);
helper.assertProblem("bind(s, 0, foo)", "bind");
+ }
+
+ // template <bool... Args>
+ // struct ice_or;
+ // template <bool First>
+ // struct ice_or<First> {
+ // static const bool value = First;
+ // };
+ // template <bool>
+ // struct S {};
+ // template <>
+ // struct S<false> {
+ // typedef int type;
+ // };
+ // int main() {
+ // S<ice_or<false>::value>::type t;
+ // }
+ public void testVariadicNonTypeTemplateParameter_401142() 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 c1ad1d0..4650cc7 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
@@ -2464,6 +2464,8 @@ public class CPPTemplates {
} else {
if (arg.isTypeValue())
return false;
+ if (par.isParameterPack() != arg.isPackExpansion())
+ return false;
int parpos= Value.isTemplateParameter(arg.getNonTypeValue());
if (parpos != par.getParameterID())
return false;