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

Eli Friedman eli.friedman at gmail.com
Wed Sep 16 23:42:02 PDT 2009


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.

-Eli




More information about the cfe-commits mailing list