Technically, yes—if it looks, smells, and tastes fine. Your nose is smarter than you think. If it passes the sniff test and hasn’t turned into a petri dish, go for it.
But if there’s even a whiff of doubt? Chuck it. A stomachache is not worth a dollop of questionable frosting. There’s always more cake in the future, my friend. Live to frost another day.