Export (0) Print
Expand All
Expand Minimize

Compiler Error C2482

'identifier' : dynamic initialization of 'thread' data not allowed

Variables declared with the thread attribute cannot be initialized with an expression that requires run-time evaluation. A static expression is required to initialize thread data.

The following sample generates C2482:

// C2482.cpp
// compile with: /c
#define Thread __declspec( thread )
Thread int tls_i = tls_i;   // C2482

int j = j;   // OK in C++; C error
Thread int tls_i = sizeof( tls_i );   // Okay in C and C++
Show:
© 2014 Microsoft