Consider:
template<typename T>
__attribute__((assume_aligned(2)))
T my_alloc(int);
(https://godbolt.org/z/EGebP7o8n)
Clang issues a diagnostic about the return type not being a pointer type despite there being no instantiations. It seems we need to add if T->isDependentType() return true; to isValidPointerAttrType(), possibly.