https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/cp/error.c.jj 2021-02-25 23:27:46.561918450 +0100 +++ gcc/cp/error.c 2021-04-15 19:10:38.389850343 +0200 @@ -1554,10 +1554,12 @@ find_typenames_r (tree *tp, int *walk_su /* Add the typename without any cv-qualifiers. */ mv = TYPE_MAIN_VARIANT (*tp); - if (PACK_EXPANSION_P (*tp)) + if (PACK_EXPANSION_P (*tp) || EXPR_P (*tp)) { /* Don't mess with parameter packs since we don't remember - the pack expansion context for a particular typename. */ + the pack expansion context for a particular typename. + Similarly, don't walk into expressions such as + those inside of TYPE_RAISES_EXCEPTIONS. */ *walk_subtrees = false; return NULL_TREE; } passed make check-c++-all and fixes the testcase.