diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -13179,7 +13179,7 @@ static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal) { SmallVector R; while (true) { - QTotal += T.Quals; + QTotal.addConsistentQualifiers(T.Quals); QualType NT = T.Ty->getLocallyUnqualifiedSingleStepDesugaredType(); if (NT == QualType(T.Ty, 0)) break; diff --git a/clang/test/SemaObjCXX/arc-objc-lifetime.mm b/clang/test/SemaObjCXX/arc-objc-lifetime.mm --- a/clang/test/SemaObjCXX/arc-objc-lifetime.mm +++ b/clang/test/SemaObjCXX/arc-objc-lifetime.mm @@ -66,3 +66,14 @@ - (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError*&)error {} @end +// See https://github.com/llvm/llvm-project/issues/61419 + +template struct pair { + T0 first; + T1 second; +}; + +NSString *p0, *p1; +const pair p = {p0, p1}; +bool b; +NSString *t = b ? p.first : p.second;