[cfe-dev] [PATCH] Libc++ Windows fixes
Ruben Van Boxem
vanboxem.ruben at gmail.com
Sat Oct 22 15:29:12 PDT 2011
2011/10/22 Ruben Van Boxem <vanboxem.ruben at gmail.com>
> 2011/10/22 Howard Hinnant <hhinnant at apple.com>
>
>> On Oct 22, 2011, at 2:05 PM, Ruben Van Boxem wrote:
>>
>> >
>> >
>> > Attached is a patch to further improve the almost hopeless situation :)
>>
>> Thanks, Committed revision 142732.
>>
>> >
>> > Also attached is a reduced (preprocessed) testcase (algorithm.cpp)
>> producing exactly one of the template errors. The empty template parameter
>> types in the error messages give the impression of a compiler bug, but I'm
>> not quite sure yet. I tried running (MinGW-based) Clang on the preprocessed
>> example, and if one ignores the missing builtin type related errors, one
>> sees these decltype related errors:
>>
>> Sorry, I don't have any insights. Compiler bug seems to me to be a good
>> guess as your clang compiler appears to be fairly old (no rvalue refs, no
>> variadics).
>>
>
> Yes, The no rvalue references is something I tried to get MSVC to compile
> this. I ran Clang on the MSVC preprocessed reduced source. Essentially,
> Clang (and mine's pretty current) fails to compile it as well. I fear the no
> variadics code that's being used here is not quite right, or at least not in
> its current syntactic form.
>
OK, attached is a renewed fixed up preprocessed source that gets accepted by
Clang and GCC (once you specify -std=c++0x of course <slaps himself on
forehead>), but rejected by MSVC 10. I don't assume there's any other way to
write this kind of construct, preserving the functionality?
I'll take it to MS next. This sucks for libc++ and MSVC...
Ruben
> Thanks for the commit!
>
> Ruben
>
>
>> Howard
>>
>> >
>> > [... other typedef related errors with nullptr, unsigned __int64, size_t
>> etc...]
>> > algorithm.cpp:140:22: error: expected parameter declarator
>> > typedef decltype(true ? __t() : __u()) type;
>> > ^
>> > algorithm.cpp:140:22: error: expected ')'
>> > algorithm.cpp:140:21: note: to match this '('
>> > typedef decltype(true ? __t() : __u()) type;
>> > ^
>> > algorithm.cpp:140:13: error: C++ requires a type specifier for all
>> declarations
>> > typedef decltype(true ? __t() : __u()) type;
>> > ~~~~~~~ ^
>> > algorithm.cpp:140:43: error: expected ';' at end of declaration list
>> > typedef decltype(true ? __t() : __u()) type;
>> > ^
>> > ;
>> > algorithm.cpp:144:1: error: C++ requires a type specifier for all
>> declarations
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ^~~~~~~~
>> > algorithm.cpp:144:1: error: variable 'decltype' declared as a template
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ^
>> > algorithm.cpp:144:16: error: no member named 'declval' in namespace
>> 'std'
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ~~~~~^
>> > algorithm.cpp:144:24: error: '_Tp' does not refer to a value
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ^
>> > algorithm.cpp:143:17: note: declared here
>> > template <class _Tp, class _Arg>
>> > ^
>> > algorithm.cpp:144:29: error: expected expression
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ^
>> > algorithm.cpp:144:38: error: no member named 'declval' in namespace
>> 'std'
>> > decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))
>> > ~~~~~^
>> >
>> > For once, these errors aren't really helpful :(, but they are radically
>> different from the MSVC errors (see above, in my quoted email). I'm building
>> a MSVC based Clang now, to see if it works better for libc++ (if at all).
>> >
>> > Thanks for any insights, comments or commits!
>> >
>> > Ruben
>> >
>> >
>> > Comments and commits welcome!
>> >
>> > Ruben
>> >
>> > <msvc.patch.txt><algorithm.cpp>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111023/30713a55/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: algorithm.cpp
Type: text/x-c++src
Size: 3600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111023/30713a55/attachment.cpp>
More information about the cfe-dev
mailing list