This question, for example, is an off-topic question that is getting upvoted. I downvoted and flagged it, just as I did this question only a few days ago.
I propose that users who upvote a question that gets closed as OT lose 1 rep.
This question, for example, is an off-topic question that is getting upvoted. I downvoted and flagged it, just as I did this question only a few days ago.
I propose that users who upvote a question that gets closed as OT lose 1 rep.
We don't all agree what should be on or off topic. The broad guidelines are clear, but some cases can be subjective.
I don't necessarily see the benefits of penalising someone for supporting a question, just because 5 others (or a mod) don't think this is a good question (not everyone necessarily understands the problem to assess whether it's on or off topic). If there was a mechanism to penalise those who upvote closed questions, we should also have a mechanism to cancel other's close votes (i.e. a vote for -1 close).
Your two examples are also rather different:
One is a question that was asked 1/2 hour ago. It's currently off-topic because it's a "help me debug my code" type of question. However, if more details were added, this probably wouldn't be a bad question, and that would make it more general and on-topic.
The other one is a 4-year old question that visibly has been of value to some users. Users were probably more tolerant back then.
Remember that the official policy is "vote how you wish", taking great care in not clarifying what "this is useful" and "this is not useful" (for answers). There's a bit more details in the tooltips for questions, but the idea remains the same. If you start penalising voting habits here, that could be a precedent for a number of other similar voting penalties with which you don't agree. (Note that downvoting answers has a cost simply to prevent abuse.)
As that first example points out, a question can start out on-topic, but then it's found that the problem is not-reproducible, so it can then be closed as off-topic->not-reproducible. No one should be penalized because of lack of psychic ability.