Title
Non-inline functions and explicit instantiation declarations
Status
nad
Section
13.9.3 [temp.explicit]
Submitter
Richard Smith

Created on 2016-06-10.00:00:00 last changed 24 months ago

Messages

Date: 2022-02-15.00:00:00

Additional note (February, 2022):

The paragraph in question was removed by P1815R2 (Translation-unit-local entities) (adopted 2020-02).

EWG 2022-11-11

Any change would require a paper.

Date: 2022-02-18.07:47:23

Consider:

  template <class F> F foo() { return 1; }
  template <class F> struct S { F foo() { return 1; } };
  extern template int foo<int>();
  extern template struct S<int>;
  int bar() { return foo<int>() + S<int>().foo(); }

An implementation is permitted to instantiate (and thus locally inline) S<int>::foo, but not S<int>, because 13.9.2 [temp.inst] paragraph 10 states:

Except for inline functions, declarations with types deduced from their initializer or return value (9.2.9.7 [dcl.spec.auto]), const variables of literal types, variables of reference types, and class template specializations, explicit instantiation declarations have the effect of suppressing the implicit instantiation of the entity to which they refer.
History
Date User Action Args
2022-11-20 07:54:16adminsetstatus: extension -> nad
2022-02-18 07:47:23adminsetmessages: + msg6713
2018-02-27 00:00:00adminsetstatus: open -> extension
2016-06-10 00:00:00admincreate