http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58408

            Bug ID: 58408
           Summary: [C++11] __thread + trivially_constructible -> error
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/10727382

This source:

class Test {
 public:
 Test() = default;
 Test(char *b) { }
 int i;
};
__thread Test test;


fails to compile with current trunk (g++ (GCC) 4.9.0 20130911 (experimental)):

g++ -c -std=c++11 /tmp/t.c

/tmp/t.cc:8:15: error: non-local variable 'test' declared '__thread' needs
dynamic initialization
 __thread Test test;
               ^
/tmp/t.cc:8:15: note: C++11 'thread_local' allows dynamic initialization and
destruction


I don't see a good reason to reject this source -- the required dynamic
initialization is defaulted.

Reply via email to