Compiler Error C2482
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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++
© 2015 Microsoft