This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++-concepts] code review
- From: Andrew Sutton <andrew dot n dot sutton at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 19 Jun 2013 11:10:20 -0500
- Subject: Re: [c++-concepts] code review
- References: <CANq5Syt5s-NgazOYbT5wtYSRsbZUqcivoer1w4jiucx5qYKMfA at mail dot gmail dot com> <CAAiZkiAn9rpPmPKXztUA4rd3CH6w3=tn7jz=oksk65Ypx6RpGg at mail dot gmail dot com> <51B0B0ED dot 5090508 at redhat dot com> <CANq5SystWWs=AOAYAHmRjfx17itDrYQj+GtdUr=-XYGLV_4=6g at mail dot gmail dot com> <51B0F122 dot 6020301 at redhat dot com> <CANq5SysFjY39osn-Xp3HXE-Due7C=D2-VKrhjKdLtpws8rH=mg at mail dot gmail dot com> <51B62961 dot 1080409 at redhat dot com> <CAAiZkiDY5LZRwgEAmc1VPhbMXJ1ytU_Q2Fj9tSyN1M_T7NMMfw at mail dot gmail dot com> <51B8A36C dot 1080005 at redhat dot com> <CANq5SyuWOKxWshSBb8uxtN8d6HMgifJdDcQSrsSwazRjE=v2NQ at mail dot gmail dot com> <51BBC613 dot 5040708 at redhat dot com> <CANq5SysgoJ0nVdrqLMjFqaWcmz97dB03qbKCs_ZpoBS+OVYzfg at mail dot gmail dot com> <51BF617D dot 3080101 at redhat dot com> <CANq5SyshsCtsQgGvCj6hVexa4m-st0-yM1PpLq=R68YXkfz_aw at mail dot gmail dot com> <51C1BE59 dot 6040400 at redhat dot com>
>> + // If the types of the underlying templates match, compare
>> + // their constraints. The declarations could differ there.
>> + if (types_match)
>> + types_match = equivalent_constraints (get_constraints
>> (olddecl),
>> + current_template_reqs);
>
>
> We can't assume that current_template_reqs will always apply to newdecl
> here, as decls_match is called in overload resolution as well. What's the
> problem with attaching the requirements to the declaration before we get to
> duplicate_decls?
It's because newdecl doesn't have a template_info at the point at
which this is called, and the constraints are associated through that
information. This seems like another good reason for keeping
constraints with template decls.
Until I change that, I can just test to see if newdecl has template
info. If so, I'll use its constraints. If not, I'll use the current
requirements.
Andrew