[clang] [Clang] allow restrict qualifier for array types with pointer types as element types (PR #120896)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 12:06:23 PST 2025
================
@@ -1593,35 +1593,40 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
// object or incomplete types shall not be restrict-qualified."
if (Qs.hasRestrict()) {
unsigned DiagID = 0;
- QualType ProblemTy;
-
- if (T->isAnyPointerType() || T->isReferenceType() ||
- T->isMemberPointerType()) {
- QualType EltTy;
- if (T->isObjCObjectPointerType())
- EltTy = T;
- else if (const MemberPointerType *PTy = T->getAs<MemberPointerType>())
+ QualType EltTy = Context.getBaseElementType(T);
+
+ if (EltTy->isAnyPointerType() || EltTy->isReferenceType() ||
+ EltTy->isMemberPointerType()) {
+
+ if (const MemberPointerType *PTy = EltTy->getAs<MemberPointerType>())
----------------
AaronBallman wrote:
```suggestion
if (const auto *PTy = EltTy->getAs<MemberPointerType>())
```
https://github.com/llvm/llvm-project/pull/120896
More information about the cfe-commits
mailing list