[cfe-commits] r39954 - in /cfe/trunk: AST/Type.cpp Sema/SemaExpr.cpp

Chris Lattner clattner at apple.com
Mon Jul 16 21:56:37 PDT 2007


> @@ -597,8 +597,10 @@
>    QualType t = e->getType();
>    assert(!t.isNull() && "DefaultFunctionArrayConversion - missing  
> type");

The two changes to isReferenceType look good, but:

>
> -  if (const ReferenceType *ref = dyn_cast<ReferenceType> 
> (t.getCanonicalType()))
> -    t = promoteExprToType(e, ref->getReferenceeType()); // C++ [expr]
> +  if (const ReferenceType *ref = dyn_cast<ReferenceType>(t)) {

This won't work.  You want:

     if (const ReferenceType *ref = t->isReferenceType()) {
    ...

> +    promoteExprToType(e, ref->getReferenceeType()); // C++ [expr]
> +    t = e->getType();
> +  }
>    if (t->isFunctionType())
>      promoteExprToType(e, Context.getPointerType(t));
>    else if (const ArrayType *ary = dyn_cast<ArrayType> 
> (t.getCanonicalType()))
> @@ -614,8 +616,10 @@
>    QualType t = expr->getType();
>    assert(!t.isNull() && "UsualUnaryConversions - missing type");
>
> -  if (const ReferenceType *ref = dyn_cast<ReferenceType> 
> (t.getCanonicalType()))
> -    t = promoteExprToType(expr, ref->getReferenceeType()); // C++  
> [expr]
> +  if (const ReferenceType *ref = dyn_cast<ReferenceType>(t)) {

Likewise.

-Chris

> +    promoteExprToType(expr, ref->getReferenceeType()); // C++ [expr]
> +    t = expr->getType();
> +  }
>    if (t->isPromotableIntegerType()) // C99 6.3.1.1p2
>      promoteExprToType(expr, Context.IntTy);
>    else
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list