This is annoying, because you cannot install Xcode from the App Store on Yosemite. To get around this, navigate to the Xcode downloads page and grab the Xcode 6.4 beta. You may be asked to login to your developer account. Even if you're not a registered developer, do it anyway. The download should start without a hitch.

Once it finishes, install the Xcode 6.4 beta, then run:

sudo xcode-select -s /Applications/Xcode6-Beta4.app/

Brew should now be able to compile correctly. If not, drop me a note in the comments and I'll try to help out, as I have it working on my machine now.