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



             Bug #: 57163

           Summary: Link failure with thread_local

                    std::default_random_engine

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: jleahy+...@gmail.com





Created attachment 30026

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30026

Preprocessed input files



Output of gcc -v:

Thread model: posix

gcc version 4.8.0 (GCC)

Target: x86_64-unknown-linux-gnu



Input file test.cpp:

#include <random>

extern thread_local std::default_random_engine rng;

int main() { return rng(); }



Input file test2.cpp:

#include <random>

thread_local std::default_random_engine rng;



Command line and output:

g++ -std=c++11 -c test.cpp && g++ -std=c++11 -c test2.cpp && g++ -std=c++11

test.o test2.o

test.o:test.cpp:function _ZTW3rng: error: undefined reference to '_ZTH3rng'

collect2: error: ld returned 1 exit status



Complete preprocessed output attached. I can't reproduce this with a single

translation unit.

Reply via email to