Created on 2009-09-15.00:00:00 last changed 190 months ago
[Voted into WP at March, 2010 meeting.]
Proposed resolution (February, 2010):
Change 6.7 [basic.link] paragraph 8 as follows:
Names not covered by these rules have no linkage. Moreover, except as noted, a name declared in a local scope (6.4.3 [basic.scope.block]) has no linkage. A type is said to have linkage if and only if:
it is a class or enumeration type that is named (or has a name for linkage purposes (9.2.4 [dcl.typedef])) and the name has linkage; or
it is an unnamed class or enumeration member of a class with linkage; or
...
The recent changes to allow use of unnamed types as template arguments require some rethinking of how unnamed types are treated in general. At least, a class-scope unnamed type should have the same linkage as its containing class. For example:
// File "hdr.h"
struct S {
static enum { No, Yes } locked;
};
template<class T> void f(T);
// File "impl1.c"
#include "hdr.h"
template void f(decltype(S::locked));
// File "impl2.c"
#include "hdr.h"
template void f(decltype(S::locked));
The two explicit instantiation directives should refer to the same specialization.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2010-03-29 00:00:00 | admin | set | messages: + msg2662 |
| 2010-03-29 00:00:00 | admin | set | status: tentatively ready -> cd2 |
| 2010-02-16 00:00:00 | admin | set | messages: + msg2493 |
| 2010-02-16 00:00:00 | admin | set | status: drafting -> tentatively ready |
| 2009-11-08 00:00:00 | admin | set | status: open -> drafting |
| 2009-09-15 00:00:00 | admin | create | |