First of all, few have an real amount of gold. Second of all everyone has dollars now, that doesn't stop people trading with them.
Finally, your false impression that gold has NO inherent function that is useful proves you ignorant. Manufacturers use it in circuits though silver is the better conductor because it doesn't rust, same reason NASA elected to make the record for Voyager out of gold. It also lines the McClaren engine bay because its such a good heat reflector... I could keep going but there is no need. Even one example renders the absolute claim that it has no inherent function false.
I don't deny gold has value for its use in the things you've mentioned, just like iron has value because its used for construction and making cars, but gold is extremely overvalued for its function. And about dollars, if we're talking about a situation where people are trading for food, ammo, water, etc in some post-apocalyptic enviroment then dollars are going to be worthless, but so is gold.