[cfe-commits] r82129 - in /cfe/trunk: lib/AST/Expr.cpp lib/Sema/SemaExpr.cpp test/SemaCXX/value-dependent-exprs.cpp

Daniel Dunbar daniel at zuster.org
Fri Sep 18 01:43:27 PDT 2009


On Wed, Sep 16, 2009 at 11:42 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Wed, Sep 16, 2009 at 11:31 PM, Daniel Dunbar <daniel at zuster.org> wrote:
> ==============================================================================
>> --- cfe/trunk/lib/AST/Expr.cpp (original)
>> +++ cfe/trunk/lib/AST/Expr.cpp Thu Sep 17 01:31:27 2009
>> @@ -1626,6 +1626,9 @@
>>  /// integer constant expression with the value zero, or if this is one that is
>>  /// cast to void*.
>>  bool Expr::isNullPointerConstant(ASTContext &Ctx) const {
>> +  // Ignore value dependent expressions.
>> +  if (isValueDependent())
>> +    return true;
>>   // Strip off a cast to void*, if it exists. Except in C++.
>>   if (const ExplicitCastExpr *CE = dyn_cast<ExplicitCastExpr>(this)) {
>>     if (!Ctx.getLangOptions().CPlusPlus) {
>
> It's kind of confusing to claim that something which may not be a null
> pointer constant is a null pointer constant.  It would be clearer for
> the callers to explicitly deal with this case.

Yes, I wasn't sure about this part. My logic was that assuming it was
a null pointer constant would be conservatively safe, but I can't
convince myself of this so I change it to an assert and FIXME that
part of the test for now.

 - Daniel




More information about the cfe-commits mailing list