This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60702] New: thread_local initialization


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

            Bug ID: 60702
           Summary: thread_local initialization
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dv.main at gmail dot com

Created attachment 32480
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32480&action=edit
Gcc verbose output

Invalid thread local object initialization.
Snippet:

#include <iostream>

using namespace std;

struct far {
    struct boo {
        boo () {
            cerr << "bar::boo" << endl;
        }
        int i = 42;
    };

    static void baz() {
        cerr << far::FOO.i << endl;
    }

    static thread_local boo FOO;
};

thread_local typename far::boo far::FOO;

int main() {
    far f;
    cerr << f.FOO.i << endl;
    cerr << far::FOO.i << endl;
    return 0;
}

Output:
0
bar::boo
42


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]