Glitch with Yamato Cannons?
Solution 1:
This is intended and is referred to as "Smart Casting", and it makes it easier to micro manage your units. In Starcraft 1, you would often over cast your spells. For example, if you had a selected group of High Templar and you casted psionic storm, every single one of your templar would cast psionic storm in the same spot, which is a waste of energy.
It's much more efficient to just press the hot-key of the unit's spell.
As a note, be careful about holding shift before casting any spell. If the unit is doing anything before you queue the spell, the unit will not cast the spell until the previous action is done.
For example, your BCs are sitting there, and then a swarm of mutas attack you. You press and hold shift to queue up yamato cannons, but wait! your BCs started auto-attacking before you could give the yamato cannon command. Now they completly ignore the yamato cannon order until all mutas are dead. This same problem exists for all other spell casting units.