This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Template argument deduction from reference argument


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]