It is fine unless the class has restrictions on the types of spells that you can cast.
If your LG sorcerer wants to summon a CE dretch, that works. It is a CE act and doing it too often will eventually change his alignment.
However, a LG cleric would not be able to summon a CE dretch (or even a LE lemur or CG unicorn) since clerics cannot cast spells of opposed alignments.