As host, I ask about restrictions, and cook to provide food everyone can eat. It is a challenge and usually fun. However, every meal is not a pot luck, and I don't like it when I have, say, a SW menu ready to go and someone shows up, unasked, with Thai curry, which just plain doesn't fit in, or worse, hunk'o'meat. (Special Snowflakes who bring usually uncooked meat to my vegetarian house, and then announce they've brought DINNER, throwing off my timing and my menu sometimes by an hour or more, drive me nuts! This would be FishGirl, who would only do this to me once, unless I had to have her again for some reason. Then I think the Meat BBQ would break, and that is the only place to cook meat at our house. Too bad. She'd just have to take it home.)
Like I said, as a host, I ask about restrictions and do my best to accommodate. If someone with restrictions offers to bring something, we can come up with something for them to bring that integrates into the planned menu and fits their needs. As a guest, I always offer to bring, usually a vegetarian entree, so there will be one, and then we make sure it goes seamlessly into the planned menu. The problem, to me, lies in not communicating with one's host/guest. Taking over a planned party with your unplanned-for thing that does not fit into the hosts' menu, is IMO, controlling, "specialness" to the nth degree, and quite rude. Hostess gifts of edibles are normally of the kind that do not have to be consumed right away -- wine, candy, maybe artisan bread -- and are not expected to be consumed immediately, but rather kept for the hosts' later enjoyment -- in part so these gifts will NOT screw up a planned menu and dining experience.
If I show up after being told NOT to bring, and there are things I can eat, great. I eat them. If there are not, and this has happened, literally nothing at all, I quietly do not eat, and am always grateful for the stash I keep in the car.