summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-ambig-paren-expr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-02-03 02:58:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-02-03 02:58:20 +0000
commit4378568c8f4203966f42f0705040845179708a0f (patch)
tree1212cc59ca35acfed01e9cb6f06bb8c09262925d /clang/test/Parser/cxx-ambig-paren-expr.cpp
parent9f7ec14009d8a45058409044fcf7f3d4f924f75c (diff)
downloadbcm5719-llvm-4378568c8f4203966f42f0705040845179708a0f.tar.gz
bcm5719-llvm-4378568c8f4203966f42f0705040845179708a0f.zip
Fix miscompile and rejects-valids when disambiguating after an ambiguous
C-style-cast to function/array type or parenthesized function-style cast/array indexing. llvm-svn: 259622
Diffstat (limited to 'clang/test/Parser/cxx-ambig-paren-expr.cpp')
-rw-r--r--clang/test/Parser/cxx-ambig-paren-expr.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/test/Parser/cxx-ambig-paren-expr.cpp b/clang/test/Parser/cxx-ambig-paren-expr.cpp
index 39882056723..1535b009725 100644
--- a/clang/test/Parser/cxx-ambig-paren-expr.cpp
+++ b/clang/test/Parser/cxx-ambig-paren-expr.cpp
@@ -21,8 +21,13 @@ void f() {
struct S{int operator()();};
(S())();
- // FIXME: Special case: "++" is postfix here, not prefix
- // (S())++;
+ // Special case: "++" is postfix here, not prefix
+ (S())++; // expected-error {{cannot increment value of type 'S'}}
+
+ struct X { int &operator++(int); X operator[](int); int &operator++(); };
+ int &postfix_incr = (X()[3])++;
+ (X())++ ++; // ok, not a C-style cast
+ (X())++ ++X(); // expected-error {{C-style cast from 'int' to 'X ()'}}
}
// Make sure we do tentative parsing correctly in conditions.
OpenPOWER on IntegriCloud