mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-02 21:23:37 +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:
parent
68a9017f2e
commit
499bc0f1a7
2 changed files with 14 additions and 1 deletions
|
@ -10347,11 +10347,13 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
|
|
||||||
// class Waldo {
|
// class Waldo {
|
||||||
// typedef int type;
|
// typedef int type;
|
||||||
|
// static int value;
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// int main() {
|
// int main() {
|
||||||
// Waldo w;
|
// Waldo w;
|
||||||
// decltype(w)::type i;
|
// decltype(w)::type i;
|
||||||
|
// int x = decltype(w)::value;
|
||||||
// }
|
// }
|
||||||
public void testDecltypeInNameQualifier_bug380751() throws Exception {
|
public void testDecltypeInNameQualifier_bug380751() throws Exception {
|
||||||
parseAndCheckBindings();
|
parseAndCheckBindings();
|
||||||
|
|
|
@ -1541,6 +1541,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
case IToken.t_decltype:
|
case IToken.t_decltype:
|
||||||
case IToken.t_void:
|
case IToken.t_void:
|
||||||
case IGCCToken.t_typeof:
|
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());
|
firstExpression = simpleTypeConstructorExpression(simpleTypeSpecifier());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1738,7 +1748,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
case IToken.tCOLONCOLON:
|
case IToken.tCOLONCOLON:
|
||||||
case IToken.t_operator:
|
case IToken.t_operator:
|
||||||
case IToken.tCOMPLETION:
|
case IToken.tCOMPLETION:
|
||||||
case IToken.tBITCOMPLEMENT: {
|
case IToken.tBITCOMPLEMENT:
|
||||||
|
case IToken.t_decltype: {
|
||||||
IASTName name = qualifiedName(ctx, strat);
|
IASTName name = qualifiedName(ctx, strat);
|
||||||
IASTIdExpression idExpression = nodeFactory.newIdExpression(name);
|
IASTIdExpression idExpression = nodeFactory.newIdExpression(name);
|
||||||
return setRange(idExpression, name);
|
return setRange(idExpression, name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue