This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR c++/42260


On 12/22/2009 07:44 AM, Dodji Seketeli wrote:
On Mon, Dec 14, 2009 at 01:08:08PM -0500, Jason Merrill wrote:
On 12/14/2009 12:31 PM, Dodji Seketeli wrote:
the code that looks for a conversion from A to something* should
complain about choosing a template.

I first tried to make lookup_conversions not return any template conversion operator when called from within add_builtin_candidates. That was breaking things because sometimes the template conversion op can be properly instantiated. In thoses cases we need to consider that that conversion op.

When does this happen?


I then tried in the patch below to avoid considering the operator '*'
as a built-in candidate when it's operand has a dependent type. Having a
built-in operator operand with dependent type would otherwise mean
that we picked up a template conversion operator that couldn't be
properly instantiated and was thus converting - after being instantiated
by add_template_candidate, called by build_user_type_conversion_1 - to a
dependent type.

It's not clear to me why this would avoid breaking the same cases that would be broken by the above change.


I notice that the code in add_builtin_candidate for handling comparisons has

      if (TYPE_PTR_P (type1)
          && null_ptr_cst_p (args[1])
          && !uses_template_parms (type1))

I guess similarly checking !uses_template_parms in the INDIRECT_REF case would be the minimal fix.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]