https://github.com/alexey-bataev commented: I think you missed template instantion in SemaTemplateInstantiateDecl.cpp (it silently drops prefer_type) and check ClangAttrEmitter.cpp, need to support PCH https://github.com/llvm/llvm-project/pull/212307