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

--- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #9)
> (In reply to Jakub Jelinek from comment #7)
> > (In reply to Patrick Palka from comment #6)
> > > This fixes it:
> > 
> > Are you going to post it to gcc-patches (with ChangeLog and testcase)?
> 
> It doesn't yet make sense to me why r226642 introduces this regression. Once
> I figure it out I'll post the patch.

This change

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8187,14 +8187,14 @@ lookup_template_class (tree d1, tree arglist, tree
in_decl, tree context,
 tree
 lookup_template_variable (tree templ, tree arglist)
 {
-  tree type = unknown_type_node;
+  tree type = NULL_TREE;
   return build2 (TEMPLATE_ID_EXPR, type, templ, arglist);
 }

made finish_id_expression later wrap the variable-template expression in a
SCOPE_REF since the expression is now considered dependent (dependent_type_p
returns true for a NULL_TREE).  But later during instantiation, tsubst is not
yet prepared to handle a SCOPE_REF whose RHS is a variable template and the
patch I posted seems to address that.

Reply via email to