summaryrefslogtreecommitdiffstats
path: root/clang/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
commit12179bc014fe1edc7e9e6cca92ff93b1f321c9d1 (patch)
tree6502d19897781e20fc9b6366f6fe07deb0d55be6 /clang/test/Parser/cxx-ambig-paren-expr.cpp
parent5da1f0858748f39602a9b1f593f831afa3da7454 (diff)
downloadbcm5719-llvm-12179bc014fe1edc7e9e6cca92ff93b1f321c9d1.tar.gz
bcm5719-llvm-12179bc014fe1edc7e9e6cca92ff93b1f321c9d1.zip
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 llvm-svn: 72260
Diffstat (limited to 'clang/test/Parser/cxx-ambig-paren-expr.cpp')
-rw-r--r--clang/test/Parser/cxx-ambig-paren-expr.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-ambig-paren-expr.cpp b/clang/test/Parser/cxx-ambig-paren-expr.cpp
new file mode 100644
index 00000000000..c054164e750
--- /dev/null
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud