Article ID: 117383 - Last Review: July 5, 2005 - Revision: 2.1 BUG: C2483 Instantiating Objects with the Thread AttributeThis article was previously published under Q117383 On This PageSYMPTOMS Instantiating a C++ object with the thread attribute
generates the following error message if the class contains private or
protected members: error C2483: object with constructor
cannot be declared 'thread' CAUSE Currently, thread local storage has only been implemented
for aggregate types. An aggregate type is defined as an array or object of a
class with no constructors, no private or protected members, no base classes,
and no virtual functions. In this case, private or protected members make the
class an aggregate; therefore, the error message is generated. RESOLUTION To avoid this error, make all private or protected members
of the class public members. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
MORE INFORMATION The sample code below demonstrates how to produce and avoid
the error message. Uncomment the "public" keyword before the data member to
avoid the error. Sample CodeAPPLIES TO
| Article Translations
|
Back to the top
