More constness checks for #2573

This adds some more compile-time checks for https://github.com/D-Programming-Language/phobos/pull/2573.