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

Hendrik Hübner via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 06:59:33 PDT 2026


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

Fixes #150403

cc: @rjmccall 

>From 9b78ed33016420997619a0cda5d318ef01aa15b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hendrik=20H=C3=BCbner?= <hhuebner at MacBookPro.localdomain>
Date: Thu, 11 Jun 2026 15:55:55 +0200
Subject: [PATCH] [ObjC] Fix Assertion failure when merging declarations with
 different lifetime qualifiers

Fixes #150403
---
 clang/lib/AST/ASTContext.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index abf0cd5e18c2b..e936572458444 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -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())
       return {};
 
     // Exactly one GC qualifier difference is allowed: __strong is



More information about the cfe-commits mailing list