Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4216,17 +4216,12 @@ break; case ICK_Block_Pointer_Conversion: { - QualType LHSType = Context.getCanonicalType(ToType).getUnqualifiedType(); - QualType RHSType = Context.getCanonicalType(FromType).getUnqualifiedType(); - - // Assumptions based on Sema::IsBlockPointerConversion. - assert(isa(LHSType) && "BlockPointerType expected"); - assert(isa(RHSType) && "BlockPointerType expected"); - LangAS AddrSpaceL = - LHSType->getAs()->getPointeeType().getAddressSpace(); + ToType->castAs()->getPointeeType().getAddressSpace(); LangAS AddrSpaceR = - RHSType->getAs()->getPointeeType().getAddressSpace(); + FromType->castAs()->getPointeeType().getAddressSpace(); + assert(Qualifiers::isAddressSpaceSupersetOf(AddrSpaceL, AddrSpaceR) && + "Invalid cast"); CastKind Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast; From = ImpCastExprToType(From, ToType.getUnqualifiedType(), Kind,