Template argument deduction from reference argument

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Thu Jul 20 00:53:00 GMT 2000


> Does this mean that
> - template argument type S is deduced from actual argument S &?

Yes, it does.

> - an instance (t) of an abstract class is thereby created?

No, it doesn't produce any instances - the program won't run, as it is
ill-formed. If you correct the error, you get another one talking
about pure virtual functions.

> I would have expected T to be bound to S &.

Not in C++. An expression of reference type is converted into an
lvalue of its underlying type before any further analysis starts
([expr]/6).

Regards,
Martin


More information about the Gcc mailing list