- Title
- When is inline permitted in an explicit instantiation?
- Status
- cd1
- Section
- 13.9.3 [temp.explicit]
- Submitter
- Steve Clamage
Created on 2005-12-07.00:00:00 last changed 217 months ago
Messages
Date: 2007-04-15.00:00:00
[Voted into the WP at the April, 2007 meeting as part of paper
J16/07-0095 = WG21 N2235.]
Date: 2006-04-15.00:00:00
Notes from the April, 2006 meeting: The CWG favored completely disallowing the inline keyword in
explicit instantiation directives.
Date: 2005-12-07.00:00:00
The Standard does not definitively say when the inline
specifier may be used in an explicit instantiation. For example,
the following would seem to be innocuous, as the function being
instantiated is already inline: However, presumably one would want to prohibit something like: 9.2.3 [dcl.fct.spec] paragraph 4 (after application of the
resolution of issue 317) comes close to
covering the obvious problematic cases: This would seem to prohibit the latter case, but apparently would
not handle an exported template that was instantiated as inline
(because the definition might not appear in the same translation unit
as the inline instantiation). It would be better to make a clear
statement regarding the use of inline in explicit
instantiations.
template <typename T> struct S {
void f() { }
};
template inline void S<int>::f();
template <typename T> void f(T) { }
template inline void f(int);
If the definition of a function appears in a translation unit before
its first declaration as inline, the program is ill-formed. If a
function with external linkage is declared inline in one translation
unit, it shall be declared inline in all translation units in which it
appears; no diagnostic is required.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-10-05 00:00:00 | admin | set | status: wp -> cd1 |
| 2008-05-18 00:00:00 | admin | set | messages: + msg1671 |
| 2008-05-18 00:00:00 | admin | set | status: drafting -> wp |
| 2006-04-22 00:00:00 | admin | set | messages: + msg1338 |
| 2006-04-22 00:00:00 | admin | set | status: open -> drafting |
| 2005-12-07 00:00:00 | admin | create | |