Title
Exported class templates
Status
cd1
Section
Clause [13] [temp]
Submitter
Robert Klarer

Created on 2000-02-11.00:00:00 last changed 161 months ago

Messages

Date: 2003-04-15.00:00:00

[Voted into WP at April 2003 meeting.]

Date: 2002-04-15.00:00:00

Notes from the 4/02 meeting:

This is resolved by the proposed changes for issue 323.

Date: 2000-04-15.00:00:00

Notes from 04/00 meeting:

John Spicer opined that even though Clause 13 [temp] paragraph 7 speaks of "declaring a class template exported," that does not mean that the class template is "an exported template" in the sense of paragraph 8. He suggested clarifying paragraph 7 to that effect instead of the change to paragraph 8 suggested above, and questioned the need for a change to 13.9.2 [temp.inst].

Date: 2020-12-15.00:00:00

Clause 13 [temp] paragraph 7 allows class templates to be declared exported, including member classes and member class templates (implicitly by virtue of exporting the containing template class). However, paragraph 8 does not exclude exported class templates from the statement that

An exported template need only be declared (and not necessarily defined) in a translation unit in which it is instantiated.
This is an incorrect implication; however, it is also not dispelled in 13.9.2 [temp.inst] paragraph 6:
If an implicit instantiation of a class template specialization is required and the template is declared but not defined, the program is ill-formed.
This wording says nothing about the translation unit in which the definition must be provided. Contrast this with 13.9.3 [temp.explicit] paragraph 3:
A definition of a class template or a class member template shall be in scope at the point of the explicit instantiation of the class template or class member template.

Suggested resolution:


  • Change Clause 13 [temp] paragraph 8 to say that "An exported non-class template need only be declared..."
  • Change 13.9.2 [temp.inst] paragraph 6 to use wording similar to that of 13.9.3 [temp.explicit] paragraph 3 regarding the requirement for a definition of the class template to be in scope.

(See also issue 212.)

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2003-04-25 00:00:00adminsetmessages: + msg868
2003-04-25 00:00:00adminsetstatus: ready -> wp
2002-11-08 00:00:00adminsetstatus: review -> ready
2002-05-10 00:00:00adminsetmessages: + msg629
2002-05-10 00:00:00adminsetstatus: open -> review
2000-05-21 00:00:00adminsetmessages: + msg359
2000-02-11 00:00:00admincreate