aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-ambig-paren-expr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-19 00:35:18 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-19 00:35:18 +0000
commitae03cb5a84d13c7a0d4b21865bd63aabd18120d2 (patch)
treedf8b6f36fe5b797911bc53c870c50f4bddda6a9c /test/Parser/cxx-ambig-paren-expr.cpp
parent27a9b72bf1e4fe9f1d3ee9a5db1b9d614b0ee01c (diff)
Teach TryAnnotateTypeOrScopeToken to deal with already-annotated
scope specifiers. Fix a tentative parsing bug that came up in LLVM. Incidentally fixes some random FIXMEs in an existing testcase. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-ambig-paren-expr.cpp')
-rw-r--r--test/Parser/cxx-ambig-paren-expr.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp
index 31633a58d7..3988205672 100644
--- a/test/Parser/cxx-ambig-paren-expr.cpp
+++ b/test/Parser/cxx-ambig-paren-expr.cpp
@@ -24,3 +24,43 @@ void f() {
// FIXME: Special case: "++" is postfix here, not prefix
// (S())++;
}
+
+// Make sure we do tentative parsing correctly in conditions.
+typedef int type;
+struct rec { rec(int); };
+
+namespace ns {
+ typedef int type;
+ struct rec { rec(int); };
+}
+
+struct cls {
+ typedef int type;
+ struct rec { rec(int); };
+};
+
+struct result {
+ template <class T> result(T);
+ bool check();
+};
+
+void test(int i) {
+ if (result((cls::type) i).check())
+ return;
+
+ if (result((ns::type) i).check())
+ return;
+
+ if (result((::type) i).check())
+ return;
+
+ if (result((cls::rec) i).check())
+ return;
+
+ if (result((ns::rec) i).check())
+ return;
+
+ if (result((::rec) i).check())
+ return;
+}
+