This plant is Solanum nigra, black nightshade. Unlike deadly nightshade (Atropa belladonna), this plant is edible and is widely used as fodder.
Whenever we put manure down in the soil these guys invariably pop up – obviously the horses/sheep/cows that make the manure have been tucking in.
According to the experts you can make a fairly tasty jam with the berries, but they can make you sick if you eat them unripe. Recipes often call for boiling and re-boiling the leaves, and discarding the water in between. Seems like too much trouble to me, so up they come.