Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

error compiling: using __thread with template class static variable

jiuxingliu
Beginner
101 Views
Hi,

The following compiles fine under gcc 3.4 and 4.2, but fails under Intel compiler 11.0. Any insights? Thanks.

tls_test.h:
template
class tls_test
{
static __thread int i;
};

template
__thread int tls_test::i = -1;

tls_test.cpp:
#include "tls_test.h"
tls_test<2> t;

Compiler output:
$/apps/intel/Compiler/11.0/069/bin/intel64/icpc -c tls_test.cpp
tls_test.h(10): error: template argument list must match the parameter list
__thread int tls_test::i = -1;

Also tried Intel compiler 11.1 (icpc (ICC) 11.1 20090630), same result.

0 Kudos
1 Reply
Milind_Kulkarni__Int
New Contributor II
101 Views
11.0 latest does not fix the problem.

11.1 latest fix the problem.

You should not test with such old compiler version like 20090630 ..

please try latest 11.1 version
Reply