[cfe-dev] [PATCH] Libc++ Windows fixes

Howard Hinnant hhinnant at apple.com
Sat Oct 22 14:05:13 PDT 2011


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).

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>




More information about the cfe-dev mailing list