We did so for a week when visiting a cousin. My son, then just turned two, was absolutely fine. At home, even before then, he'd moved into a full-sized single bed to make way for his brother taking over the cot. Again, he's been absolutely fine. The biggest problem is that he tends to clamber out from the duvet and gets cold, so in retrospect I might have left him in a sleeping bag for longer.
As a previous poster mentioned, I'd say the biggest danger is him climbing up the ladder, but most bunks these days are pretty safe. (Some I've seen in Aspace are more like stairs to the top.) And you could either teach him how to climb it or improvise some sort of cover so that it can't be used except at night time.