[clang] [Clang][Sema] properly remove qualifiers in __is_pointer_interconvertible_base_of (PR #167881)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 17 05:05:21 PST 2025


================
@@ -15607,8 +15607,8 @@ bool Sema::IsLayoutCompatible(QualType T1, QualType T2) const {
 
 bool Sema::IsPointerInterconvertibleBaseOf(const TypeSourceInfo *Base,
                                            const TypeSourceInfo *Derived) {
-  QualType BaseT = Base->getType()->getCanonicalTypeUnqualified();
-  QualType DerivedT = Derived->getType()->getCanonicalTypeUnqualified();
+  QualType BaseT = Base->getType().getUnqualifiedType();
+  QualType DerivedT = Derived->getType().getUnqualifiedType();
----------------
AaronBallman wrote:

> also, if canonical types can have qualifiers, why is `A` the canonical type of `const A`?

I'm not certain *why* template type parameter substitution types can have canonical types with qualifiers. Maybe @erichkeane @mizvekov @zygoloid or someone else knows?

https://github.com/llvm/llvm-project/pull/167881


More information about the cfe-commits mailing list