[cfe-commits] Modulo renaming [WAS: r60615 ...]
Douglas Gregor
dgregor at apple.com
Wed Dec 10 16:33:31 PST 2008
On Dec 10, 2008, at 4:23 PM, Eli Friedman wrote:
> On Wed, Dec 10, 2008 at 4:07 PM, Douglas Gregor <dgregor at apple.com>
> wrote:
>>> If you have a system that is strong enough to know that (+) is
>>> commutative,
>>> then nominal unification should be able to prove the equivalence of
>>>
>>> template<int I, int J> void f(int (&array)[J+I]);
>>> template<int X, int Y> void f(int (&array)[X+Y]);
>>
>> Thankfully, determining that those two function templates are
>> functionally equivalent but not equivalent (per C++ [temp.over.link]
>> p7) is in the realm of "ill-formed, no diagnostic required." Of
>> course, a "high quality implementation" would detect such errors...
>
> Also, we need to preserve the form of the original expression tree in
> the canonical type: AFAIK, doing name mangling in a compatible way
> requires it.
Right. Name mangling is based on the actual expression as written in
the source code, except that we replace the names of template
parameters with their index into the template parameter list. We'll
likely do the same thing for canonical types, where the "canonical"
version of a template parameter is just its position in the template
parameter list.
- Doug
More information about the cfe-commits
mailing list