[cfe-dev] The integer-constant-expr patch

Chris Lattner clattner at apple.com
Wed Jun 4 10:32:57 PDT 2008


Hi Steve,

Your change to isIntegerConstantExpr is somewhat ok, but it has a  
serious problem:

       // GCC accepts pointers as an extension.
       // FIXME: check getLangOptions().NoExtensions. At the moment,  
it doesn't
       // appear possible to get langOptions() from the Expr.
       if (SubExpr->getType()->isPointerType()) // && !NoExtensions
         return true;

When this returns you don't set 'Result'.  isIntegerConstantExpr is  
required to return the constant expression when a pointer is  
involved.  This means you should only return true if the operand is  
foldable.

This is PR2413.

-Chris



More information about the cfe-dev mailing list