Title
extern template prevents inlining functions not marked inline
Status
nad
Section
13.9.3 [temp.explicit]
Submitter
US

Created on 2010-08-03.00:00:00 last changed 174 months ago

Messages

Date: 2010-08-15.00:00:00

Rationale (August, 2010):

If implementations are allowed to do speculative instantiation for the purpose of inlining, there could be silent changes of meaning depending on whether the instantiation is done or not.

Date: 2022-11-20.07:54:16
N3092 comment USĀ 76

According to 13.9.3 [temp.explicit] paragraph 9,

Except for inline functions and class template specializations, explicit instantiation declarations have the effect of suppressing the implicit instantiation of the entity to which they refer.

This means that an implementation cannot do inline expansion of an extern template function or member function, because that would require its instantiation. As a result, adding an explicit instantiation declaration can affect performance, even though the user only intended to suppress out-of-line copies of functions.

History
Date User Action Args
2010-08-23 00:00:00adminsetmessages: + msg2956
2010-08-03 00:00:00admincreate