It would depend if it's legal where you are, and what your company's policy is. If you work at a cannabis dispensary where it's legal, then it might be okay. If you work at a bank, then it's not okay.
One time I thought my co-worker was smoking weed indoors on his break -- perhaps I'm not the greatest judge of the smell -- and I asked if he was when he got back on the clock. He said he wasn't.