An EnumDecl *is* a NamedDecl (it derives from it), no need to dyn_cast or create an extra var. Just use ED here instead of ND.