Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3662,7 +3662,15 @@ // inner pointers. complainAboutMissingNullability = CAMN_InnerPointers; - if (T->canHaveNullability() && !T->getNullability(S.Context)) { + auto isDependentNonPointerType = [](QualType T) -> bool { + // FIXME: This just duplicates logic inside Type::canHaveNullability. + return T->isDependentType() && !T->isAnyPointerType() && + !T->isBlockPointerType() && !T->isMemberPointerType(); + }; + + if (T->canHaveNullability() && !T->getNullability(S.Context) && + !isDependentNonPointerType(T)) { + // Note that we allow but don't require nullability on dependent types. ++NumPointersRemaining; } Index: test/SemaObjCXX/Inputs/nullability-consistency-1.h =================================================================== --- test/SemaObjCXX/Inputs/nullability-consistency-1.h +++ test/SemaObjCXX/Inputs/nullability-consistency-1.h @@ -13,5 +13,13 @@ int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}} }; +template +struct Typedefs { + typedef T *Base; // no-warning + typedef Base *type; // expected-warning{{pointer is missing a nullability type specifier}} +}; + +Typedefs xx; +Typedefs yy;