I'd say no - it should be illegal. The reason isn't to prevent harm or keep you from doing it, but to identify you as a person who wants to do it. That is, to identify a character trait which separates you from the larger community. Those of us who don't have the trait don't need the law - we aren't going to do it anyhow. We find it repugnant and disgusting. What's more, we expect others to feel the same way. If you don't, you get connected to the act and also become an object to revile - the disgust transfers.
Under this rubric, making it a law serves as a way to codify and communicate something about how society views an act. Not that the act itself has some separate and objective "wrongness," but only that your fellows deem it so. "We are the sort of people who do not have sex with corpses."
Under this rubric, making it a law serves as a way to codify and communicate something about how society views an act. Not that the act itself has some separate and objective "wrongness," but only that your fellows deem it so. "We are the sort of people who do not have sex with corpses."