Suppose it could be shown that it would maximize the long-run welfare of everybody affected if people were taught that there is a moral obligation to avoid suicide - so that people would be motivated to avoid suicide just because they thought it wrong (would have anticipatory guilt feelings at the very idea), and so that other people would be inclined to disapprove of persons who commit suicide unless there were some excuse . . . . One might ask: how could it maximize utility to mold the conceptual and motivational structure of persons in this way? To which the answer might be: feeling in this way might make persons who are impulsively inclined to commit suicide in a bad mood, or a fit of anger or jealousy, take more time to deliberate; hence, some suicides that have bad effects generally might be prevented. In other words, it might be a good thing in its effects for people to feel about suicide in the way they feel about breach of promise or injuring others, just as it might be a good thing for people to feel a moral obligation not to smoke, or to wear seat belts. However, it might be that negative moral feelings about suicide as such would stand in the way of action by those persons whose welfare really is best served by suicide and whose suicide is the best thing for everybody concerned.
From Richard R. Brandt, "The Morality and Rationality of Suicide" (1975), in Life, Death, and Meaning: Key Philosophical Readings on the Big Questions, ed. David Benatar (2004).