]> granicus.if.org Git - clang/commitdiff
C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 16 Aug 2008 19:45:32 +0000 (19:45 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 16 Aug 2008 19:45:32 +0000 (19:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/Parser/cxx-casting.cpp

index c8856198fd2d6ee6e3709932886b98de9302e465..4b45cb73f61807c31758481c68f8eb5a4d37508c 100644 (file)
@@ -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.
index 1e06e981e4c6c777089c322558b4e03a71ddb0e1..4b11dc8a2bcea89d4e94cf0e984cd68b49ace124 100644 (file)
@@ -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