summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-08-21 01:34:39 (EDT)
committerSergey Prigogin2013-09-05 20:03:54 (EDT)
commit499bc0f1a7709a0d544a43b168ca2dd56fade8e9 (patch)
treef26124b19649a5be67b92201342a5e4a3d65127a
parent68a9017f2e477e3e9cd10e3ebde73e3cde12f77f (diff)
downloadorg.eclipse.cdt-499bc0f1a7709a0d544a43b168ca2dd56fade8e9.zip
org.eclipse.cdt-499bc0f1a7709a0d544a43b168ca2dd56fade8e9.tar.gz
org.eclipse.cdt-499bc0f1a7709a0d544a43b168ca2dd56fade8e9.tar.bz2
Bug 380751 - Support decltype(expr)::name in an expression contextrefs/changes/83/15683/5
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>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java13
2 files changed, 14 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index 6c60716..3a24358 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -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();
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 b8981c9..694cb93 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
@@ -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);