<div class="gmail_quote">2011/10/19 Ruben Van Boxem <span dir="ltr"><<a href="mailto:vanboxem.ruben@gmail.com">vanboxem.ruben@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div class="im">2011/10/17 Howard Hinnant <span dir="ltr"><<a href="mailto:hhinnant@apple.com" target="_blank">hhinnant@apple.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div></div></div>

Committed revision 142235.<br>
<br>
I modified the alignas support a little bit.  If I messed it up, let me know.<br></blockquote></div><div><br>It looks okay, and compiles fine. Thanks for the continued commit support!<br><br>Hi,<br>
<br>
Attached is a new patch for libc++ and msvc interoperability.<br>
<br>
I added a new MSVC only support header for <limits>, and implemented it as platform-specifically as I could/should :).<br>
I renamed a "__value" variable to "__value_"; "__value" is a CLR (MSVC's
 Managed C++) keyword, and it produces an error in non-CLR mode.<br>
The notable changes are at the bottom of the patch file.<br>
<br>
It gets me as far as this undecipherable error (which is in a _LIBCPP_HAS_NO_VARIADICS section, this will not change in the near future; MSVC 11.0 will not have variadic templates... grrrr):<br>
<br>
M:\Development\Source\libc++\include\type_traits(1192) : error C2516: 
'std::common_type<_Tp>::type' : is not a legal base class<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1122) : see declaration of 'std::common_type<_Tp>::type'<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1192) : see 
reference to class template instantiation 
'std::__is_assignable_imp<_Tp,_Arg,__formal>' being compiled<br>
M:\Development\Source\libc++\include\type_traits(1244) : error C2516: 
'std::common_type<_Tp>::type' : is not a legal base class<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1122) : see declaration of 'std::common_type<_Tp>::type'<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1244) : see 
reference to class template instantiation 
'std::__destructible_imp<_Tp,__formal>' being compiled<br>
M:\Development\Source\libc++\include\type_traits(2013) : error C2516: 
'std::common_type<_Tp>::type' : is not a legal base class<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1122) : see declaration of 'std::common_type<_Tp>::type'<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(2013) : see 
reference to class template instantiation 
'std::__is_constructible0_imp<__formal,_Tp>' being compiled<br>
M:\Development\Source\libc++\include\type_traits(2021) : error C2516: 
'std::common_type<_Tp>::type' : is not a legal base class<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1122) : see declaration of 'std::common_type<_Tp>::type'<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(2021) : see 
reference to class template instantiation 
'std::__is_constructible1_imp<__formal,_Tp,_A0>' being compiled<br>
M:\Development\Source\libc++\include\type_traits(2029) : error C2516: 
'std::common_type<_Tp>::type' : is not a legal base class<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(1122) : see declaration of 'std::common_type<_Tp>::type'<br>
        with<br>
        [<br>
            _Tp=<br>
        ]<br>
        M:\Development\Source\libc++\include\type_traits(2029) : see 
reference to class template instantiation 
'std::__is_constructible2_imp<__formal,_Tp,_A0,_A1>' being 
compiled<br>
M:\Development\Source\libc++\include\utility(264) : error C4519: default template arguments are only allowed on a class template<br>
        M:\Development\Source\libc++\include\utility(352) : see 
reference to class template instantiation 'std::pair<_T1,_T2>' 
being compiled<br><br>There's two different errors here: C2516 and C4519. I hope these aren't insurmountable unimplemented template features. I'm sure you could shed more light on what feature or implementation detail is being relied on here. The second error does seem to be caused by the first.<br>
</div></div></blockquote><div><br>Attached is a patch to further improve the almost hopeless situation :)<br><br>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:<br>
<br>[... other typedef related errors with nullptr, unsigned __int64, size_t etc...]<br>algorithm.cpp:140:22: error: expected parameter declarator<br>    typedef decltype(true ? __t() : __u()) type;<br>                     ^<br>
algorithm.cpp:140:22: error: expected ')'<br>algorithm.cpp:140:21: note: to match this '('<br>    typedef decltype(true ? __t() : __u()) type;<br>                    ^<br>algorithm.cpp:140:13: error: C++ requires a type specifier for all declarations<br>
    typedef decltype(true ? __t() : __u()) type;<br>    ~~~~~~~ ^<br>algorithm.cpp:140:43: error: expected ';' at end of declaration list<br>    typedef decltype(true ? __t() : __u()) type;<br>                                          ^<br>
                                          ;<br>algorithm.cpp:144:1: error: C++ requires a type specifier for all declarations<br>decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>^~~~~~~~<br>
algorithm.cpp:144:1: error: variable 'decltype' declared as a template<br>decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>^<br>algorithm.cpp:144:16: error: no member named 'declval' in namespace 'std'<br>
decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>          ~~~~~^<br>algorithm.cpp:144:24: error: '_Tp' does not refer to a value<br>decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>
                       ^<br>algorithm.cpp:143:17: note: declared here<br>template <class _Tp, class _Arg><br>                ^<br>algorithm.cpp:144:29: error: expected expression<br>decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>
                            ^<br>algorithm.cpp:144:38: error: no member named 'declval' in namespace 'std'<br>decltype((std::declval<_Tp>() = std::declval<_Arg>(), true_type()))<br>                                ~~~~~^<br>
<br>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).<br>
<br>Thanks for any insights, comments or commits!<br><br>Ruben<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote">
<div>
<br>Comments and commits welcome!<br><font color="#888888"><br>Ruben<br></font></div></div>
</blockquote></div><br>