Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2011-07-20 09:54:43 -0400
committerMarkus Schorn2011-07-20 09:54:43 -0400
commit9840061bd608aaf9b5a14c38dbb7da8bca9bd097 (patch)
tree6371419f7162f5336ed61812dc1319f6fa67bfad /core
parent5c46a13bd31fe7a9f5e19a629b965cb1ca66ea47 (diff)
downloadorg.eclipse.cdt-9840061bd608aaf9b5a14c38dbb7da8bca9bd097.tar.gz
org.eclipse.cdt-9840061bd608aaf9b5a14c38dbb7da8bca9bd097.tar.xz
org.eclipse.cdt-9840061bd608aaf9b5a14c38dbb7da8bca9bd097.zip
Bug 352266: Template paramter without name, but with default value
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java14
2 files changed, 12 insertions, 7 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 fc1b4bcd99..2a88223cef 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
@@ -5434,4 +5434,9 @@ public class AST2TemplateTests extends AST2BaseTest {
public void testRRefVsRef_351927() throws Exception {
parseAndCheckBindings();
}
+
+ // template <typename = int> class A {};
+ public void testTemplateParameterWithoutName_352266() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index 2d13fb9e1e..46bbf254f3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -2097,16 +2097,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (LT(1) == IToken.tIDENTIFIER) { // optional identifier
identifierName = identifier();
endOffset = calculateEndOffset(identifierName);
- if (LT(1) == IToken.tASSIGN) { // optional = type-id
- if (parameterPack)
- throw backtrack;
- consume();
- defaultValue = typeId(DeclarationOptions.TYPEID); // type-id
- endOffset = calculateEndOffset(defaultValue);
- }
} else {
identifierName = nodeFactory.newName();
}
+ if (LT(1) == IToken.tASSIGN) { // optional = type-id
+ if (parameterPack)
+ throw backtrack;
+ consume();
+ defaultValue = typeId(DeclarationOptions.TYPEID); // type-id
+ endOffset = calculateEndOffset(defaultValue);
+ }
// Check if followed by comma
switch (LT(1)) {

Back to the top