[cfe-commits] r122592 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 3 18:08:16 PST 2011


On Dec 28, 2010, at 1:13 AM, Abramo Bagnara wrote:

> Author: abramo
> Date: Tue Dec 28 03:13:41 2010
> New Revision: 122592
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=122592&view=rev
> Log:
> Canonicalize types before possible cast.
> 
> Modified:
>    cfe/trunk/lib/Sema/SemaExpr.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=122592&r1=122591&r2=122592&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Dec 28 03:13:41 2010
> @@ -4501,7 +4501,8 @@
>   // Also, callers should have filtered out the invalid cases with
>   // pointers.  Everything else should be possible.
> 
> -  QualType SrcTy = Src->getType();
> +  QualType SrcTy = S.Context.getCanonicalType(Src->getType());
> +  DestTy = S.Context.getCanonicalType(DestTy);
>   if (S.Context.hasSameUnqualifiedType(SrcTy, DestTy))
>     return CK_NoOp;

I don't understand why we have to canonicalize so early... isn't the real fix to use getAs<ComplexType> rather than cast<ComplexType>?

	- Doug



More information about the cfe-commits mailing list