I photographed my grandmother a while before she passed, I was OK with that and now am glad I took those images at the time I did rather than before her health declined.

I once photographed the funeral/church service of a photographer acquaintance's grandfather (upon my acquaintance's request) with the purpose of sharing the images with the rest of his platoon from service years that were not financially or physically able to travel. I was less OK with that (even though no open casket images), but was told many times how it was good for the other veterans to be able to "attend" and thus considered the slight discomfort I felt quite worth it.

I would not be OK with taking post-mortem images nor have any desire for them, although I do admit my feelings may change if it were someone close to me. I can't anticipate my reaction. No judgement passed on those who would be interested, however.