diff --git a/clang/CodeGen/CGExprScalar.cpp b/clang/CodeGen/CGExprScalar.cpp index 755fd56de660..97efa33fc5a3 100644 --- a/clang/CodeGen/CGExprScalar.cpp +++ b/clang/CodeGen/CGExprScalar.cpp @@ -419,8 +419,9 @@ Value *ScalarExprEmitter::VisitImplicitCastExpr(const ImplicitCastExpr *E) { llvm::Value *Ops[] = {Idx0, Idx0}; return Builder.CreateGEP(V, Ops, Ops+2, "arraydecay"); } else if (E->getType()->isReferenceType()) { - assert(cast(E->getType())->getReferenceeType() == - Op->getType() && "Incompatible types!"); + assert(cast(E->getType().getCanonicalType())-> + getReferenceeType() == + Op->getType().getCanonicalType() && "Incompatible types!"); return EmitLValue(Op).getAddress(); }