I am in a clan war, and I will get more loot than I have room for in my clan castle. If I upgrade my castle before I collect the loot, will there be more to collect than there currently is?
Whenever you receive loot, you only receive the full amount (if your resources have space for them all), or up to the amount to entirely fill up your resource tanks. The rest is lost into the abyss.
As for upgrading your resource tanks/clan castle - Overspilled resources (that amount that couldn't fit into your already-full resource buildings) cannot be recovered.
All I can suggest is that always have a big-enough resource storage or: make sure you can house more resource than you can think of ever getting.
(My resource tanks always get filled up by the harvesting of a single full resource collector. Basically: My resource tanks can hold one third of what I harvest.)