https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69775
felix.esch.42+dev at gmail dot com <felix.esch.42+dev at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |felix.esch.42+dev at gmail dot com --- Comment #1 from felix.esch.42+dev at gmail dot com <felix.esch.42+dev at gmail dot com> --- Created attachment 38241 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38241&action=edit minimal example with --save-tems Run with: g++ -std=c++14 tls-error.cpp tls-main.cpp -o tls-error d This is a minimal example. The extra header / cpp unit is necesary and compiling all in one compilation unit does not trigger this error. Using -std=c++11 does not change the behaviour. Running the command above yields no executable file and the following output: /tmp/ccyxWUc5.o: In function `TLS wrapper function for A::var': tls-main.cpp:(.text._ZTWN1A3varE[_ZTWN1A3varE]+0x5): undefined reference to `TLS init function for A::var' collect2: error: ld returned 1 exit status I use gcc v 5.3 on 64 bit arch linux: Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-5-20160209/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 5.3.0 (GCC)