Hi.

I have two functions:

(A):
TBool MyFunctionX(const TUint16 myInt, const TDesC16& aData)
{
RDebug::Printf("normal version of MyFunctionX()\n");
return EFalse;
}

(B):
template<typename T>
TBool MyFunctionX(const TUint16 myInt, const T& aData)
{
RDebug::Printf("templated version of MyFunctionX() %d \n", sizeof(T));
return EFalse;
}

and variables:

_LIT16(KDesC16,"16 bit descriptor, length:28");
TBufC16<28> buf16(KDesC16);

case 1:

A call to:

MyFunctionX(513, buf16);

calls (B) (which is strange!)
where compiler generates specialization of the template like this:

template< TBufC16<28> >
TBool MyFunctionX(TUint16 myInt, const TBufC16<28>& aData)


case 2:

2) A call to:

MyFunctionX(513, (const TDesC16& )buf16);
calls (A) (which is correct)


case 3:

A call to:
MyFunctionX<const TDesC&>(513, buf16);
calls (B) (which is correct)

Why can I not pass buf16 (on its own with no casting or whatever, as in the first case) as an argument normally and have (A) be called as that would be normal/expected behaviour...?

Thanks,
Chi