Greg Colvin wrote:
> Any thoughts on this issue?
>
>> From: Steve Clamage <[EMAIL PROTECTED]>
>> To: C++ core language mailing list
>> Message c++std-core-9820
>>
>> Some compilers implement thread-local storage (TLS) for what would
>> otherwise be global variables. The compiler and runtime system
>> arrange for each thread to see its own copy of a global variable.
>>
>> Should the address of such a variable be allowed as a non-type
>> template parameter?  For example, this code is OK:
>>        extern int k;
>>        template< int* V > class C { ... };
>>        C<&k> ck;
>>
>> But what if k is designated thread-local?  The actual variable
>> referred to by the address of k will differ among threads.

Looks like a no-brainer, &k can't be a compile-time constant if k is
thread-local.

1.

void f()
{
    C<&k> ck;
}

2.

void f()
{
    typedef C<&k> ck_type;
    ck_type ck;
}

3.

typedef C<&k> ck_type;

void f()
{
    ck_type ck;
}

The type of ck cannot depend on the thread that is executing f.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to