On Thu, Dec 11, 2025 at 11:04:43AM -0500, Marek Polacek wrote:
> On Thu, Dec 11, 2025 at 07:55:38PM +0700, Jason Merrill wrote:
> > On 12/11/25 5:17 AM, Marek Polacek wrote:
> > > On Fri, Dec 05, 2025 at 10:18:34PM +0530, Jason Merrill wrote:
> > > > > @@ -3437,9 +3444,24 @@ finish_class_member_access_expr (cp_expr
> > > > > object, tree name, bool template_p,
> > > > > return error_mark_node;
> > > > > }
> > > > > + /* For OBJECT.[:S::fn:] the BASELINK can be inside a SCOPE_REF.
> > > > > + This happens, but, until Reflection, not for a class member
> > > > > access. */
> > > > > + if (TREE_CODE (name) == SCOPE_REF && BASELINK_P (TREE_OPERAND
> > > > > (name, 1)))
> > > > > + name = TREE_OPERAND (name, 1);
> > > >
> > > > Why does this happen? Why isn't the SCOPE_REF folded into the BASELINK?
> > >
> > > Happens in:
> > >
> > > struct S {
> > > void foo () {}
> > > };
> > >
> > > template <typename T>
> > > void qux ()
> > > {
> > > S s {};
> > > s.[:(T) ^^S::foo:] ();
> > > }
> > >
> > > void
> > > corge ()
> > > {
> > > qux <decltype (^^int)> ();
> > > }
> > >
> > > In cp_parser_postfix_dot_deref_expression:
> > > * cp_parser_splice_expression gives us a SPLICE_EXPR (~it's dependent)
> >
> > Yes.
> >
> > > * since parser->scope is S, we create a SCOPE_REF in build_qualified_name
> >
> > As discussed in _dot_deref, parser->scope shouldn't be set by the time we
> > get back there, so I guess fixing that should make this hunk unnecessary.
>
> OK. I'm going to look at this now.
Now removed!
<https://forge.sourceware.org/marek/gcc/commit/e80382adc5251c6d8388692803fd497542301e6f>
Marek