just use some common sense.
if you wake up with a slight sore throat that gets progressively better throughout the day, yea sure you could probably do something constructive in the gym.
if youve got a headache, fever, runny nose, and it feels like youre swallowing glass when you try to take a sip of a liquid you probably wont be worth a shit in the gym.
i dont generally get sick, i am lucky enough to be superman-like in that sense, but i do occasionally get sore throats when i diet, so i take that as a hint to take some time off and eat at/slightly above maintenance for two weeks and let my immune system up-regulate. theres zero sense in forcing your body to recover from two things simultaneously.