컴파일러 오류 C2496
'identifier': 'selectany'는 외부 링크가 있는 데이터 항목에만 적용할 수 있습니다.
selectany 특성은 외부에 표시되는 전역 데이터 항목에만 적용할 수 있습니다.
다음 샘플에서는 C2496을 생성합니다.
// C2496.cpp
// compile with: /c
__declspec(selectany) int x1 = 1;
const __declspec(selectany) int x2 = 2; // C2496
static __declspec(selectany) int x6 = 6; // C2496
extern const __declspec(selectany) int x3 = 3;
__declspec(selectany) int x4;
// dynamic initialization of x5
int f();
__declspec(selectany) int x5 = f();
extern const int x7;
// OK - redeclaration of x7 that is extern
const __declspec(selectany) int x7 = 7;