https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123143
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I hit this again today while messing around with Reflection, and I think the
fix is simple:
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -22453,7 +22453,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)
}
}
else if (TREE_CODE (member) == SCOPE_REF
- && TREE_CODE (TREE_OPERAND (member, 1)) == TEMPLATE_ID_EXPR)
+ && TREE_CODE (TREE_OPERAND (member, 1)) == TEMPLATE_ID_EXPR
+ && identifier_p (TREE_OPERAND (TREE_OPERAND (member, 1), 0)))
{
/* Lookup the template functions now that we know what the
scope is. */
Patrick, do you mind if I take this?