@@ -1216,6 +1216,8 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {
12161216}
12171217
12181218bool Sema::isValidPointerAttrType (QualType T, bool RefOkay) {
1219+ if (T->isDependentType ())
1220+ return true ;
12191221 if (RefOkay) {
12201222 if (T->isReferenceType ())
12211223 return true ;
@@ -1284,7 +1286,7 @@ static void handleNonNullAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
12841286 for (unsigned I = 0 , E = getFunctionOrMethodNumParams (D);
12851287 I != E && !AnyPointers; ++I) {
12861288 QualType T = getFunctionOrMethodParamType (D, I);
1287- if (T-> isDependentType () || S.isValidPointerAttrType (T))
1289+ if (S.isValidPointerAttrType (T))
12881290 AnyPointers = true ;
12891291 }
12901292
@@ -1409,8 +1411,7 @@ void Sema::AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
14091411 AllocAlignAttr TmpAttr (Context, CI, ParamIdx ());
14101412 SourceLocation AttrLoc = CI.getLoc ();
14111413
1412- if (!ResultType->isDependentType () &&
1413- !isValidPointerAttrType (ResultType, /* RefOkay */ true )) {
1414+ if (!isValidPointerAttrType (ResultType, /* RefOkay */ true )) {
14141415 Diag (AttrLoc, diag::warn_attribute_return_pointers_refs_only)
14151416 << &TmpAttr << CI.getRange () << getFunctionOrMethodResultSourceRange (D);
14161417 return ;
0 commit comments