There's no reason why we wouldn't check for dependent scopes when parsing the target of an alias declaration, and indeed not doing so led to the ICE here. The rest of the patch improves the diagnostic for this testcase (and some others). Tested x86_64-pc-linux-gnu, applying to trunk. Also applying the cp_parser_type_name hunk to 4.8.