foo() is not volatile.
It's a function that returns a volatile int.
Which is legal. But strange for a returned int.
Member functions, on the other hand, can be volatile for the same reason they can be const -- both describe the object this is pointing to.