[cfe-commits] r54850 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/Parser/cxx-casting.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Sat Aug 16 12:45:32 PDT 2008


Author: akirtzidis
Date: Sat Aug 16 14:45:32 2008
New Revision: 54850

URL: http://llvm.org/viewvc/llvm-project?rev=54850&view=rev
Log:
C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces.

Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/Parser/cxx-casting.cpp

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=54850&r1=54849&r2=54850&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sat Aug 16 14:45:32 2008
@@ -538,7 +538,9 @@
   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.

Modified: cfe/trunk/test/Parser/cxx-casting.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-casting.cpp?rev=54850&r1=54849&r2=54850&view=diff

==============================================================================
--- cfe/trunk/test/Parser/cxx-casting.cpp (original)
+++ cfe/trunk/test/Parser/cxx-casting.cpp Sat Aug 16 14:45:32 2008
@@ -29,3 +29,8 @@
 {
   return static_cast<double>(i);
 }
+
+char postfix_expr_test()
+{
+  return reinterpret_cast<char*>(0xdeadbeef)[0];
+}
\ No newline at end of file





More information about the cfe-commits mailing list