[PATCH] D26843: Make sizeof expression context partially evaluated

Paulo Matos via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 01:50:44 PST 2016


pmatos created this revision.
pmatos added a reviewer: efriedma.
pmatos added a subscriber: cfe-commits.

Ensure sizeof expression context is partially evaluated so that potential typeof operators inside are evaluated if necessary.

Fixes PR31042.


https://reviews.llvm.org/D26843

Files:
  lib/Parse/ParseExpr.cpp


Index: lib/Parse/ParseExpr.cpp
===================================================================
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -1881,7 +1881,10 @@
   if (OpTok.isOneOf(tok::kw_alignof, tok::kw__Alignof))
     Diag(OpTok, diag::warn_cxx98_compat_alignof);
 
-  EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated,
+  EnterExpressionEvaluationContext Unevaluated(Actions,
+					       OpTok.is(tok::kw_sizeof) ?
+					       Sema::PotentiallyEvaluated :
+					       Sema::Unevaluated,
                                                Sema::ReuseLambdaContextDecl);
 
   bool isCastExpr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26843.78487.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161118/b6e9b91b/attachment.bin>


More information about the cfe-commits mailing list