This documentation is archived and is not being maintained.

Compiler Error C2482

Error Message

'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++