On the other hand, why not an EF-S 24mm F2.0 pancake, rather than F2.8 ? More interesting, for those (like me) who still have APS-C format.
The lens flange distance for both EF and EF-S mount are 44mm. When you look at any EF lens. The lense mount sticks out 5mm into the flange. Therefore only 39mm is allowed between the sensor and the distance of the last optical element. Therefore the 40 f2.8 EF is already semi -retrofocus design. And Cannon has done a good job in making it into a pancake by keeping it at f2.8.
For EF-S, with a smaller mirror, the last optical element gets another 3.5 mm into the camera body. That make it 35.5 mm between the last optical elemnt and the sensor. Canon has alread done an excellent job to make the EF-S 24/2.8 into a pancake. Anything faster than that will not be a pancake.
As to answer Surapon's question, 24mm EF lens must be a retrofocus design. therefore it is hard to be a pancake. As a foot note, Voigtlander makes a 20/3.5 that is almost a pancake. The design diagram shows that it is retrofocus design. they have done a super job to keep it small. One of their trick is to keep it at 3.5 instead of 2.8 or faster.