From 16d63a727eb0930137c41f98901f44dbdd530b36 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 16 Aug 2008 19:45:32 +0000 Subject: [PATCH] C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces. llvm-svn: 54850 --- clang/lib/Parse/ParseExpr.cpp | 4 +++- clang/test/Parser/cxx-casting.cpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index c8856198fd2d..4b45cb73f618 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/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/clang/test/Parser/cxx-casting.cpp b/clang/test/Parser/cxx-casting.cpp index 1e06e981e4c6..4b11dc8a2bce 100644 --- a/clang/test/Parser/cxx-casting.cpp +++ b/clang/test/Parser/cxx-casting.cpp @@ -29,3 +29,8 @@ double static_cast_test(int i) { return static_cast(i); } + +char postfix_expr_test() +{ + return reinterpret_cast(0xdeadbeef)[0]; +} \ No newline at end of file