`TD->getTemplatedDecl()` might not be a DeclContext variant, which can trigger an assertion inside `isa<>`. Differential Revision: https://reviews.llvm.org/D91380