On Sat, 11 Jan 2003 12:32:16 -0800, "Paul Mensonides"
<[EMAIL PROTECTED]> wrote:

>> 14.3.1/2 [quote--
>>
>> A local type, a type with no linkage, an unnamed type or a type compounded
>> from any of these types shall not be used as a template-argument for a
>> template type-parameter.
>>
>> --end quote]
>
>Incidently, an unnamed type has no linkage.

I think the issue is a little more subtle in that a) it's names that
have or don't have linkage, not types b) a typedef allows you to give
a name, for linkage purposes, to what C++ calls an 'unnamed type',
e.g.:

   typedef struct { int n; } s;

(Yes, I know what you are thinking now. There could be a defect about
14.3.1/2. I haven't checked the defect list though, so I don't know if
it is already there)

>Secondly, even if it is named,
>it has internal linkage if it is member of a class with internal linkage:
>
>namespace {
>
>template<class T> struct X {
>    enum value_t { value = 10 };
>};
>
>}
>
>template<class T> void f(const T& ref) {
>    // ...
>    return;
>}
>
>int main() {
>    f( X<int>::value ); // error:  X::value_t has internal linkage
>    return 0;
>}

Oops. X here has still external linkage, though of course you don't
know its "linkage name" and thus cannot refer it from another
translation unit.


Genny.

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

Reply via email to