Forbid ~str and ~[]

This corrects a rebasing error. Also adds a test so it won't happen again.