1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 380751 - Support decltype(expr)::name in an expression context

Change-Id: I8af2eb83c12bd8ebe9da58e3ddc4a2a77be47332
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/15683
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-08-21 01:34:39 -04:00 committed by Sergey Prigogin
parent 68a9017f2e
commit 499bc0f1a7
2 changed files with 14 additions and 1 deletions

View file

@ -10347,11 +10347,13 @@ public class AST2CPPTests extends AST2TestBase {
// class Waldo {
// typedef int type;
// static int value;
// };
//
// int main() {
// Waldo w;
// decltype(w)::type i;
// int x = decltype(w)::value;
// }
public void testDecltypeInNameQualifier_bug380751() throws Exception {
parseAndCheckBindings();

View file

@ -1541,6 +1541,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.t_decltype:
case IToken.t_void:
case IGCCToken.t_typeof:
if (LT(1) == IToken.t_decltype) {
// Might be an id-expression starting with a decltype-specifier.
IToken marked = mark();
try {
firstExpression = primaryExpression(ctx, strat);
break;
} catch (BacktrackException e) {
backup(marked);
}
}
firstExpression = simpleTypeConstructorExpression(simpleTypeSpecifier());
break;
@ -1738,7 +1748,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tCOLONCOLON:
case IToken.t_operator:
case IToken.tCOMPLETION:
case IToken.tBITCOMPLEMENT: {
case IToken.tBITCOMPLEMENT:
case IToken.t_decltype: {
IASTName name = qualifiedName(ctx, strat);
IASTIdExpression idExpression = nodeFactory.newIdExpression(name);
return setRange(idExpression, name);