Can I use bolts to attach a bed to the walls of my room?
As long as the wood that you use to construct your bed frame is strong enough in its own right to be used as a bed frame you should have no problems supporting the frame from both ends by bolting into the concrete wall. 

Bolts that are 1/2" in diameter should be plenty strong in shear to support a bed frame mounted in this manner. Three or four equally spaced bolts per end would give you an even distribution of support for the frame at each of the concrete walls. If you can penetrate the walls by two to three inches and install good quality anchors there should be no problems with the bolts staying tight and in place. Using a drop-in internally threaded anchor type should provide you the ability to use standard threaded bolts that can then be removed easily with the anchor staying in place in the wall. If you look at the RM-12 type you'll need 5/8 inch holes in the wall that are a minimum of 2" deep. This type of anchor also includes the need of a setting tool to expand the anchor into the concrete before installing the threaded bolts. The RM-12 offers a 3/4" thread depth. 

For best application of the bed frame it would be recommended to build it to fit to the shape of the walls so that the end pieces can be solidly bolted up to the wall. If you elect to stay with the rectangular frame and then I would recommend that backer be placed behind the end piece where each bolt is located. Obviously a wedge piece, as you surmised, would be the best as a full length backer. If you do go with just backer blocks or the wedge one way to get a nice look would be to add an additional facer trim board as shown below. If the gap out of square across the width of the bed is only 1" you will never notice it once you get a matress and bedding up on the deck.