When can't I use a squash in a recipe which calls for pumpkin?
I agree that, in general, other squashes can be substituted for pumpkin. I have tried some different types of squashes but obviously there are many more that I haven't tried.

There are definitely differences in flavor- these will obviously change a dish but not ruin it.

The biggest differences I have run into are water content and texture.

When roasting squash the cooking time might need to be adjusted to obtain a product with the needed consistency. Using pie as an example- I have had to adjust my cooking to avoid a runny pie filling. Obviously in some recipes, such as soup, this won't be as important.

Some squash, such as spaghetti, have stringy textures that would be odd where smooth pumpkin is expected.