I really don't know if its a bug, or wanted. But the compass isn't showing in the direction the bed where you set your new spawnpoint, it's always showing to the direction of the world spawn. So it's for the player useless, when you aren't building at the world spawn.
Linked issues
duplicates 1
Comments 2
Duplicate of MC-107108, which is working as intended. The compass always points to the world spawn point. And @unknown please note that the wiki is not a valid source of information what is intended or not. It describes the current state only, not the intention of mojang.
This isn't a bug, compasses are meant to point towards spawn.
https://minecraft.gamepedia.com/Compass