aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-ambig-paren-expr.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-05-22 10:24:42 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-05-22 10:24:42 +0000
commitf58f45e6d76792df8c643ce1c6d364dce5db4826 (patch)
tree54a05a54efa7adea73c568d67e8bec7340ac8849 /test/Parser/cxx-ambig-paren-expr.cpp
parentd974a7b72eb84cdc735b189bcea56fd37e13ebf6 (diff)
Handle correctly a very ugly part of the C++ syntax. We cannot disambiguate between a parenthesized type-id and
a paren expression without considering the context past the parentheses. Behold: (T())x; - type-id (T())*x; - type-id (T())/x; - expression (T()); - expression git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72260 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-ambig-paren-expr.cpp')
-rw-r--r--test/Parser/cxx-ambig-paren-expr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Parser/cxx-ambig-paren-expr.cpp b/test/Parser/cxx-ambig-paren-expr.cpp
new file mode 100644
index 0000000000..c054164e75
--- /dev/null
+++ b/test/Parser/cxx-ambig-paren-expr.cpp
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+void f() {
+ typedef int T;
+ int x, *px;
+
+ // Type id.
+ (T())x; // expected-error {{used type 'T (void)'}}
+ (T())+x; // expected-error {{used type 'T (void)'}}
+ (T())*px; // expected-error {{used type 'T (void)'}}
+
+ // Expression.
+ x = (T());
+ x = (T())/x;
+}