public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60702] New: thread_local initialization
@ 2014-03-28 22:47 dv.main at gmail dot com
  2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dv.main at gmail dot com @ 2014-03-28 22:47 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-22 22:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 22:47 [Bug c++/60702] New: thread_local initialization dv.main at gmail dot com
2014-03-28 22:48 ` [Bug c++/60702] " dv.main at gmail dot com
2014-03-28 22:49 ` dv.main at gmail dot com
2014-03-28 22:52 ` dv.main at gmail dot com
2014-04-02 22:44 ` arturomdn at gmail dot com
2020-11-04 15:21 ` redi at gcc dot gnu.org
2021-08-22 22:48 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).