diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-22 10:24:42 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-22 10:24:42 +0000 |
commit | 12179bc014fe1edc7e9e6cca92ff93b1f321c9d1 (patch) | |
tree | 6502d19897781e20fc9b6366f6fe07deb0d55be6 /clang/test/Parser/cxx-ambig-paren-expr.cpp | |
parent | 5da1f0858748f39602a9b1f593f831afa3da7454 (diff) | |
download | bcm5719-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.cpp | 15 |
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; +} |