Index: clang/lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiate.cpp +++ clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2083,6 +2083,11 @@ if (Member->getDeclContext() != Pattern) continue; + // BlockDecls can appear in a default-member-initializer. They must be the + // child of a BlockExpr, so we only know how to instantiate them from there. + if (isa(Member)) + continue; + if (Member->isInvalidDecl()) { Instantiation->setInvalidDecl(); continue; Index: clang/test/SemaCXX/instantiate-blocks.cpp =================================================================== --- clang/test/SemaCXX/instantiate-blocks.cpp +++ clang/test/SemaCXX/instantiate-blocks.cpp @@ -30,3 +30,12 @@ noret((float)0.0, double(0.0)); // expected-note {{in instantiation of function template specialization 'noret' requested here}} } +namespace rdar41200624 { +template +struct S { + int (^p)() = ^{ return 0; }; + T (^t)() = ^{ return T{}; }; + T s = ^{ return T{}; }(); +}; +S x; +}