On Sun, Nov 30, 2025 at 11:00:03PM +0530, Jason Merrill wrote:
> > + /* When doing foo.[: bar :], cp_parser_postfix_dot_deref_expression wants
> > + to see an identifier or a TEMPLATE_ID_EXPR, if we have something like
> > + s.template [: ^^S::var :]<int> where S::var is a variable template.
> > */
> > + if (member_access_p)
> > + {
> > + /* Grab the unresolved expression then. */
> > + t = unresolved;
> > + if (DECL_P (t))
> > + /* We cannot forget what context we came from, so build up
> > + a SCOPE_REF. */
> > + t = build_qualified_name (/*type=*/NULL_TREE, CP_DECL_CONTEXT (t),
> > + DECL_NAME (t), /*template_p=*/false);
> > + else if (OVL_P (t))
> > + t = OVL_NAME (t);
>
> It seems wrong to throw away the result of our earlier name lookup, can we
> instead improve ...dot_deref... to handle these forms as arguments?
It is wrong and it affects real-world testcases.
I've made some work on it in the last 2 weeks in
https://forge.sourceware.org/marek/gcc/pulls/110
where the member access splicing now works I think correctly for
non-template members and to some extent for template members too,
but Marek didn't want to push further changes to his branch except for patch
review feedback. So, do you want this to be fixed (or at least partially fixed)
as part of the patch review, or can it be kept as is and I'll then post
the incremental patch for review afterwards?
Jakub