|
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: Michel Morin (mimomorin_at_[hidden])
Date: 2011-09-01 13:30:03
John Maddock wrote:
>> Update:
>> `__is_pod` and `__is_empty` can be safely used with libc++.
>>
>> A patch attached (against trunk). All the tests run fine.
>
> 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.
Regards,
Michel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk