The actor was best recognised for his roles in the Carry On films and as the sorting hat in Harry Potter.