I've had this happen before as well, but only on the C++ editor. It seems to be when the Intellisense parser has a mental breakdown. In my case, Intellisense kept telling me I had an error and wouldn't build my program, even though the program was syntactically correct.
(Intellisense said I had a brace missing...)
The precursor to my Intellisense failing was losing the syntax highlight in the editor for anything I typed after line 27, although I think the line number is irrelevant.
Restarted VS2012 and it built straight away. Most likely "one of those things" but it is incredibly annoying :(