https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96330

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> Tried
> --- gcc/cp/pt.c.jj    2020-07-27 10:38:19.000000000 +0200
> +++ gcc/cp/pt.c       2020-07-27 17:25:09.748240198 +0200
> @@ -16838,14 +16838,17 @@ tsubst_copy (tree t, tree args, tsubst_f
>      case TEMPLATE_ID_EXPR:
>        {
>       /* Substituted template arguments */
> -     tree fn = TREE_OPERAND (t, 0);
> +     tree expr = TREE_OPERAND (t, 0);
>       tree targs = TREE_OPERAND (t, 1);
>  
> -     fn = tsubst_copy (fn, args, complain, in_decl);
> +     expr = tsubst_copy (expr, args, complain, in_decl);
>       if (targs)
>         targs = tsubst_template_args (targs, args, complain, in_decl);
>  
> -     return lookup_template_function (fn, targs);
> +        if (variable_template_p (expr))
> +       return lookup_and_finish_template_variable (expr, targs, complain);
> +     else
> +       return lookup_template_function (expr, targs);
>        }
>  
>      case TREE_LIST:
> but that just means an ICE elsewhere.

Hmm, seems using lookup_template_variable instead of
lookup_and_finish_template_variable works.

Reply via email to