Updated mangling specs
Martin von Loewis
loewis at informatik.hu-berlin.de
Fri Jan 28 18:07:55 UTC 2000
> 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.
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.
More information about the cxx-abi-dev
mailing list