This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Template argument deduction from reference argument
- To: maeder at glue dot ch
- Subject: Re: Template argument deduction from reference argument
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Thu, 20 Jul 2000 09:45:18 +0200
- CC: gcc at gcc dot gnu dot org
- References: <3975B780.89ABF7C7@glue.ch>
> 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