aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-16 19:45:32 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-16 19:45:32 +0000
commitb348b810e788c6c16129d99b99408a06e4639e0c (patch)
tree2421ebed2be4cc5f90479ec95a49f358e98e15a0
parent289d77302aa81dc24bf7aa75b36cb00a70a44bb5 (diff)
C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54850 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseExpr.cpp4
-rw-r--r--test/Parser/cxx-casting.cpp5
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index c8856198fd..4b45cb73f6 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -538,7 +538,9 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
case tok::kw_dynamic_cast:
case tok::kw_reinterpret_cast:
case tok::kw_static_cast:
- return ParseCXXCasts();
+ Res = ParseCXXCasts();
+ // These can be followed by postfix-expr pieces.
+ return ParsePostfixExpressionSuffix(Res);
case tok::kw_this:
Res = ParseCXXThis();
// This can be followed by postfix-expr pieces.
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index 1e06e981e4..4b11dc8a2b 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -29,3 +29,8 @@ double static_cast_test(int i)
{
return static_cast<double>(i);
}
+
+char postfix_expr_test()
+{
+ return reinterpret_cast<char*>(0xdeadbeef)[0];
+} \ No newline at end of file