Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Morgner2019-02-26 07:24:28 -0500
committerFelix Morgner2019-04-16 08:34:24 -0400
commit480af1ddb10a8b07466809f6ffb175180011a15c (patch)
tree4170896fbe53dd4efd480617bf7135444ac2462b
parente153fa920d41caf4456943e9950f79866215dcb2 (diff)
downloadorg.eclipse.cdt-480af1ddb10a8b07466809f6ffb175180011a15c.tar.gz
org.eclipse.cdt-480af1ddb10a8b07466809f6ffb175180011a15c.tar.xz
org.eclipse.cdt-480af1ddb10a8b07466809f6ffb175180011a15c.zip
Bug 544818: Unparenthesized conditional expressions in trailing return
type causes parse error Change-Id: I55131a2f1b6c6eec674f4f298b320d31a78d2829 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=544818 Signed-off-by: Felix Morgner <fmorgner@hsr.ch>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java2
2 files changed, 9 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java
index fbaae3ff4d..6a4f372377 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/ASTCPPSpecDefectTests.java
@@ -76,4 +76,11 @@ public class ASTCPPSpecDefectTests extends AST2TestBase {
parseAndCheckBindings();
}
+ // auto f(int x, int y) -> decltype(x < y ? x : y) {
+ // return x < y ? x : y;
+ // }
+ public void testUnparenthesizedConditionalExpressionInTrailingReturnType_544818() 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 b58abf0c40..cf8815ba4f 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
@@ -621,6 +621,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
}
return AMBIGUOUS_TEMPLATE_ID;
+ } catch (EndOfFileException ignored) {
+ return NO_TEMPLATE_ID;
} finally {
backup(mark);
}

Back to the top