Context. Gas expulsion is a central concept in some of the models for multiple populations and the light-element anti-correlations in globular clusters. If the star formation efficiency was around 30 per cent and the gas expulsion happened on the crossing timescale, this process could preferentially expel stars born with the chemical composition of the proto-cluster gas, while stars with special composition born in the centre would remain bound. Recently, a sample of extragalactic, gas-free, young massive clusters has been identified that has the potential to test the conditions for gas expulsion. Aims. We investigate the conditions required for residual gas expulsion on the crossing timescale. We consider a standard initial mass function and different models for the energy production in the cluster: metallicity-dependent stellar winds, radiation, supernovae and more energetic events, such as hypernovae, which are related to gamma ray bursts. The latter may be more energetic than supernovae by up to two orders of magnitude. Methods. We computed a large number of thin-shell models for the gas dynamics, and calculated whether the Rayleigh-Taylor instability is able to disrupt the shell before it reaches the escape speed. Results. We show that the success of gas expulsion depends on the compactness index of a star cluster C 5 ≡ (M * /10 5 M )/(r h /pc), with initial stellar mass M * and half-mass radius r h . For given C 5 , a certain critical, local star formation efficiency is required to remove the rest of the gas. Common stellar feedback processes may not lead to gas expulsion with significant loss of stars above C 5 ≈ 1. Considering pulsar winds and hypernovae, the limit increases to C 5 ≈ 30. If successful, gas expulsion generally takes place on the crossing timescale. Some observed young massive clusters have 1 < C 5 < 10 and are gas-free at ≈10 Myr. This suggests that gas expulsion does not affect their stellar mass significantly, unless powerful pulsar winds and hypernovae are common in such objects. By comparison to observations, we show that C 5 is a better predictor for the expression of multiple populations than stellar mass. The best separation between star clusters with and without multiple populations is achieved by a stellar winds-based gas expulsion model, where gas expulsion would occur exclusively in star clusters without multiple populations. Single and multiple population clusters also have little overlap in metallicity and age. Conclusions. Globular clusters should initially have C 5 100, if the gas expulsion paradigm was correct. Early gas expulsion, which is suggested by the young massive cluster observations, hence would require special circumstances, and is excluded for several objects. Most likely, the stellar masses did not change significantly at the removal of the primordial gas. Instead, the predictive power of the C 5 index for the expression of multiple populations is consistent with the idea that gas expulsion may prevent the expression of multiple populations. On this bas...