Updated mangling specs
Daveed Vandevoorde
daveed at edg.com
Fri Jan 28 18:26:51 UTC 2000
Martin von Loewis wrote:
>
> > Consider the following example:
> >
> > // file 1:
> > template<int I> int f(A<I+1>::X) { return 1; }
> > template void f<1>(A<2>::X);
> >
> > // file 2:
> > template<int I> int f(A<2*I>::X) { return 2; }
> > template void f<1>(A<2>::X);
>
> Maybe I'm having problem with the English language here. The phrase is
>
> # Two expressions involving template parameters that are not
> # equivalent are functionally equivalent if, for any given set of
> # template arguments, the evaluation of the expression results in the
> # same value.
>
> Does that mean: They are functionally equivalent if there exists a set
> of arguments so they evaluate to the same value?
>
> Or does that mean: They are functionally equivalent if they evaluate
> to the same value for every set of template arguments?
>
> I'd interpret that as meaning the former: I+1 and 2*I are functionally
> eqivalent, because there is an I (I=1) for which the value is the
> same.
It's definitely the latter interpretation. The intent was to express the
"inverted A" quantifier, though it probably would have been clearer to
say "for all" instead of "for any".
> As a result, your example would ill-formed: It defines two templates
> which are functionally equivalent but not equivalent.
>
> Of course, if it meant the latter, your example would be
> well-formed. I'm not sure what kinds of heroic efforts the distinction
> of functionally equivalent and equivalent would save you, though.
>
> Regards,
> Martin
>
> P.S. Under my interpretation, the example in 14.5.5.1/5 (which you had
> quoted) would be ill-formed, as the instantiations would be
> indistinguishable for I=J=K=L=0. I'd claim this as a defect, though.
Its not a defect: this was a deliberate decision by the C++ committee,
and the example was put in specifically to clarify that.
Daveed
More information about the cxx-abi-dev
mailing list