[clang] [clang][Sema] Avoid assert when diagnosing address-space qualified new/delete (PR #178424)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 7 07:15:46 PST 2026
================
@@ -2676,8 +2695,9 @@ bool Sema::CheckAllocatedType(QualType AllocType, SourceLocation Loc,
else if (AllocType.getAddressSpace() != LangAS::Default &&
!getLangOpts().OpenCLCPlusPlus)
return Diag(Loc, diag::err_address_space_qualified_new)
- << AllocType.getUnqualifiedType()
- << AllocType.getQualifiers().getAddressSpaceAttributePrintValue();
+ << AllocType.getUnqualifiedType()
+ << formatAddressSpaceForDiag(AllocType, getLangOpts(), Context);
----------------
zwuis wrote:
```cpp
<< Qualifiers::getAddrSpaceAsString(AllocType.getAddressSpace());
```
Now we know the best approach to print address spaces. Other information is redundant.
https://github.com/llvm/llvm-project/pull/178424
More information about the cfe-commits
mailing list