Boost logo

Boost :

Subject: Re: [boost] [TypeTraits] A patch for clang's intrinsics (was: [type_traits] is_enum on scoped enums doesn't works as expected)
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-01 13:47:44


Le 01/09/11 19:39, John Maddock a écrit :
>>> OK I'm curious - why would a compiler intrinsic work when used with
>>> one std
>>> lib, not not when used with another?
>>
>> Here is the details:
>>
>> libstdc++ (of gcc-4.2) defines `struct __is_pod` in some header file.
>> To deal
>> with this, clang disables __is_pod intrinsics when finding `struct
>> __is_pod`;
>> then, __is_pod is not treated as keyword and it becomes just an
>> identifier.
>> However, even in this case, old clang sets __has_feature(is_pod) to 1.
>> So we cannot rely on `#if __has_feature(is_pod)` to check the
>> availability of
>> __is_pod intrinsics.
>>
>> libc++ does not define `struct __is_pod`, so we can safely check
>> the availability of __is_pod intrinsics by `#if __has_feature(is_pod)`.
>>
>>
>> Ditto for __is_empty.
>
> Got it, that's just plain nasty isn't it?
Yes. It seems that C++ compiler and C++ standard library providers
shouldn't use the same prefix for the intrinsics and the internals.

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk