Title
Class instantiation from pointer conversion to void*, null and self
Status
cd1
Section
13.9.2 [temp.inst]
Submitter
Steve Adamczyk

Created on 1998-10-13.00:00:00 last changed 189 months ago

Messages

Date: 2002-10-15.00:00:00

[Moved to DR at October 2002 meeting.]

Date: 2002-10-15.00:00:00

[Moved to DR at October 2002 meeting.]

Date: 2022-11-20.07:54:16

A template is implicitly instantiated because of a "pointer conversion" on an argument. This was intended to include related-class conversions, but it also inadvertently includes conversions to void*, null pointer conversions, cv-qualification conversions and the identity conversion.

It is not clear whether a reinterpret_cast of a pointer should cause implicit instantiation.

Proposed resolution (10/01): Replace 13.9.2 [temp.inst] paragraph 4, up to the example, with the following:

A class template specialization is implicitly instantiated if the class type is used in a context that requires a completely-defined object type or if the completeness of the class type might affect the semantics of the program. [Note: in particular, if the semantics of an expression depend on the member or base class lists of a class template specialization, the class template specialization is implicitly generated. For instance, deleting a pointer to class type depends on whether or not the class declares a destructor, and conversion between pointer to class types depends on the inheritance relationship between the two classes involved. ]

This version differs from the previous version is its use of the word "might" in the first sentence.

(See also issue 212.)

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetstatus: dr -> wp
2002-11-08 00:00:00adminsetmessages: + msg781
2002-11-08 00:00:00adminsetstatus: ready -> dr
2002-05-10 00:00:00adminsetstatus: review -> ready
2001-11-09 00:00:00adminsetstatus: open -> review
2000-05-21 00:00:00adminsetstatus: review -> open
2000-02-23 00:00:00adminsetmessages: + msg232
2000-02-23 00:00:00adminsetstatus: open -> review
1998-10-13 00:00:00admincreate