selectany only applies to externally visible global variables. It has
the effect of making the data linkonce. MSDN doesn't seem to require
that all definitions be the same, which means clang shouldn't use
linkonceodr.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Can they be discarded? If so, please add a comment saying that they
can. If not, you need no use weak_odr.
Comment Actions
Should
static int x;
extern __declspec(selectany) int x;
work or be rejected? If rejected, LGTM with it added as a test.
Comment Actions
MSVC accepts
static int x7;
extern __declspec(selectany) int x7;
But it also accepts
static int x7;
extern int x7;
That seems like a separate issue. It doesn't seem that important to me to
accept this.
Clang errors out with 'attribute declaration must precede definition',
which doesn't seem useful to have in that test.
OK to commit as is?