From f690431adc2f9a31b2f69f71ee841a706399918c Mon Sep 17 00:00:00 2001 From: arunkumarbhattar Date: Mon, 1 May 2023 23:21:20 -0400 Subject: [PATCH] Fix for Issue #1200 "Assertion failure in checkPointerTypesForAssignment due to non-canonical RHS type" --- clang/lib/Sema/SemaExpr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 902e80bd2426..8262260ae902 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9151,6 +9151,12 @@ static bool IsInvalidCmseNSCallConversion(Sema &S, QualType FromType, // FIXME: add a couple examples in this comment. static Sema::AssignConvertType checkPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType) { + if (!LHSType.isCanonical()) + LHSType = LHSType.getCanonicalType(); + + if (!RHSType.isCanonical()) + RHSType = RHSType.getCanonicalType(); + assert(LHSType.isCanonical() && "LHS not canonicalized!"); assert(RHSType.isCanonical() && "RHS not canonicalized!");