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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
template<typename T>
void func(T t)
{
  A x;
  auto &&error = *x;          // error here
}


This auto deduction is done during template parsing instead of template
instantiation because its RHS is not type dependent, which makes sense.  The
RHS at that point however is not resolved into a method call to the appropriate
overload; it remains an INDIRECT_REF.  So during auto deduction, all it sees on
the RHS is an INDIRECT_REF so it deduces that the type of "error" is an lvalue.

It seems to me that this issue is ultimately related to PR21802 which notes
that we fail to properly perform name lookup on operators during template
parsing. If that were fixed then the RHS of the assignment during this auto
deduction would not be an INDIRECT_REF, it would be a CALL_EXPR to the
appropriate overload.

Reply via email to