What causes the Sun to appear to be in front of a building in this picture? I took this photograph a few days ago, during sunrise, using my smartphone camera and digital zoom:

It seems that the sun is in front of the building. How is this explained?
 A: You are seeing the effect of a combination of blurring - caused by an imperfect optical system - and saturation.
Blurring: ideally, a lens should map a point source into a point source. In reality, it is mapped into something slightly wider than that. If the image is well-focused, the lens is free of imperfections, and diffraction due to the finite size of the lens (aperture) is minimal, then that approximation is close to true. In your case, it's clear by looking at the image of the building that there is significant blurring: probably this is due to the image being slightly out of focus; perhaps atmospheric blur (scatter - light fog?) is contributing.  There is also something called blooming where excess exposure on one pixel causes some signal to appear on neighboring pixels. All these things contribute to a blurring of bright objects in your picture (like the sun).
Saturation: the sun is much, much brighter than the building. The exposure setting of your camera is such that an intensity that is a small fraction of the intensity of the sun causes a "fully on" pixel in the image.
In the following image I try to illustrate how a point source that is imaged through an out-of-focus lens becomes slightly blurred:

I believe that in your image, the saturation is sufficient that the edge of the sun really corresponds to part of the blurred image of the sun, as illustrated in this next image which shows the convolution of a top hat function ("the sun") with a Gaussian of different widths ("good" and "out of focus" lens). 

The "saturation" line shows a possible intensity at which pixels would appear white: as you can see, for the values I chose the sun would appear larger than it really is - and therefore it would appear to "cut through" the edge of the building. Which gives the illusion that it must be in front.
Here is a 2D demonstration of what is going on - I hope the picture and legends are self-explanatory:

I had to use log scale a couple of times because the sun is so much brighter than the "building" and background in this image.
