Forbid pub/priv where it has no effect

Closes #5495