I build a alternative Arduino Leonardo clone with the mega32u4.....
Everything works fine, but I like to replace the mega32u4 with a mega32u2, because I dont have only a small area on the PCB and the mega32u2 is cheaper.
The question is: Will the IDE load the program on a mega32u2 and do I have to expect any other incompatibility?
The Arduino IDE cannot compile sketches out of the box for the ATMEGA32u2. Do not forget to check the datasheet as I believe the U2 is missing certain functionality compared to the U4. One of the big things missing from the U2 is it has no ADC.
You would have to create a "core" and "pin map" for the U2 for the Arduino IDE to recognize the U2. You would also need a compatible bootloader.