I took a photo in P mode, with the flash on:
I noted the exposure it used — 1/3s at F2.8. I then switched to A mode, set the exposure to F2.8, and took a photo. The camera chose the same shutter speed (as one would expect), but the photo ended up subtly brighter (please open each photo in a new tab and switch between them to see the difference):
I then switched to S mode, set the exposure to 1/3s, and took a third photo, which also ended up being brighter than the one in P mode:
Why is this happening? The settings are the same in all three cases — F2.8, 1/3s, ISO 1600, flash on, flash exposure compensation -2, slow sync, regular exposure compensation 0, matrix metering, manual focus and RAW format. The only thing that changed was the mode — P, A and S. All three photos were shot using a tripod, from the same position and with the exact same framing. All three are shot using the Sigma 19mm F2.8 prime lens on the NEX-5R, and with a remote control to avoid camera shake.
BTW, this doesn't happen when the flash is off. I took another series of photos (albeit of a different scene), and I got identical photos in P, A, S and M modes. Only when the flash is on does there seem to be a change in exposure between modes.