1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 352266: Template paramter without name, but with default value

This commit is contained in:
Markus Schorn 2011-07-20 15:54:43 +02:00
parent 0613de1b42
commit 1215f96314
2 changed files with 12 additions and 7 deletions

View file

@ -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();
}
}

View file

@ -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)) {