[cfe-dev] Keyword warnings in libc++'s type_traits and other headers
Marshall Clow
mclow.lists at gmail.com
Mon Dec 23 12:16:41 PST 2013
On Dec 22, 2013, at 6:37 PM, Alp Toker <alp at nuanti.com> wrote:
>
> On 23/12/2013 00:46, Marshall Clow wrote:
>> On Dec 22, 2013, at 1:58 PM, Alp Toker <alp at nuanti.com <mailto:alp at nuanti.com>> wrote:
>>
>>> On 22/12/2013 21:27, Dimitry Andric wrote:
>>>> Hi,
>>>>
>>>> I ran into a situation where a C++ program was compiled with -Wsystem-headers. When I did this with clang 3.4 or trunk, I got the following keyword warnings:
>>> [snipped]
>>>> include/type_traits:668:8: warning: keyword '__is_unsigned' will be made available as an identifier for the remainder of the translation unit [-Wkeyword-compat]
>>>> struct __is_unsigned : public ___is_unsigned<_Tp> {};
>>>> ^
>>>> 9 warnings generated.
>>>>
>>>> This seems to have been introduced with r196212 in clang by Alp Toker, but it is unfortunate the warning hits libc++. :-) The cause is a bunch of Embarcadero keywords defined in clang's lib/Parse/ParseExpr.cpp, which are exactly the same as these libc++-internal identifers.
>>>>
>>>> Is the attached patch acceptable as a workaround?
I’m still confused.
I tried the following tests using today’s clang (and libc++):
int main () { const int i = __is_void<int>::value; }
fails to compile.
int main () { const int i = std::__is_void<int>::value; }
fails to compile.
#include <type_traits>
int main () { const int i = __is_void<int>::value; }
fails to compile.
#include <type_traits>
int main () { const int i = std::__is_void<int>::value; }
compiles successfully.
All were compiled with "-std=c++11 -stdlib=libc++”
If I add -Wsystem-headers to the final one, I get warnings like what Dimitry reported.
— Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131223/c7ffbf54/attachment.html>
More information about the cfe-dev
mailing list