I've also felt this pain before -- in essence, you're trying to tell the compiler that constness "propagates" through bar(). Unfortunately, as far as I'm aware, there is no way to do this automatically... you'll just have to write the second version of the function by hand.