[clang] [ObjC] Fix Assertion failure when merging declarations with different lifetime qualifiers (PR #203272)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 22:21:44 PDT 2026


Hendrik =?utf-8?q?Hübner?= <hhuebner at MacBookPro.localdomain>,
Hendrik =?utf-8?q?Hübner?= <hhuebner at MacBookPro.lan>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/203272 at github.com>


================
@@ -12356,7 +12356,8 @@ QualType ASTContext::mergeObjCGCQualifiers(QualType LHS, QualType RHS) {
   if (LQuals != RQuals) {
     // If any of these qualifiers are different, we have a type mismatch.
     if (LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers() ||
-        LQuals.getAddressSpace() != RQuals.getAddressSpace())
+        LQuals.getAddressSpace() != RQuals.getAddressSpace() ||
+        LQuals.getObjCLifetime() != RQuals.getObjCLifetime())
----------------
ahatanak wrote:

With this change, clang accepts the following code, which was previously rejected:

```
extern __strong id x;
extern const   id x;
```

$ clang -fsyntax-only -Xclang -fobjc-gc -x test.mm

I guess we want to reject difference in non-GC qualifiers?

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


More information about the cfe-commits mailing list