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:
parent
0613de1b42
commit
1215f96314
2 changed files with 12 additions and 7 deletions
|
@ -5434,4 +5434,9 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
public void testRRefVsRef_351927() throws Exception {
|
public void testRRefVsRef_351927() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template <typename = int> class A {};
|
||||||
|
public void testTemplateParameterWithoutName_352266() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2097,16 +2097,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
if (LT(1) == IToken.tIDENTIFIER) { // optional identifier
|
if (LT(1) == IToken.tIDENTIFIER) { // optional identifier
|
||||||
identifierName = identifier();
|
identifierName = identifier();
|
||||||
endOffset = calculateEndOffset(identifierName);
|
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 {
|
} else {
|
||||||
identifierName = nodeFactory.newName();
|
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
|
// Check if followed by comma
|
||||||
switch (LT(1)) {
|
switch (LT(1)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue