[cfe-dev] Fixes to partial ordering break Boost.Hana

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 16 12:09:11 PST 2017


CC Richard who committed this in the first place, and Hans to track this as a potential release blocker.

— 
Mehdi


> On Jan 16, 2017, at 11:17 AM, Pavel A. Lebedev via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> Any comments on this?
> As it stands, clang 4 will be unusable with Boost.Hana,
> at least the already released versions.
> In case this is actually the library's fault, this is being discussed at
> https://github.com/boostorg/hana/issues/318
> 
>> -----Original Message-----
>> From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Pavel A. Lebedev via cfe-dev
>> Sent: Tuesday, January 10, 2017 2:21 AM
>> To: 'Clang Dev' <cfe-dev at lists.llvm.org>
>> Subject: [cfe-dev] Fixes to partial ordering break Boost.Hana
>> 
>> Hi.
>> 
>> Commit r290511 "Fix some subtle wrong partial ordering bugs particularly
>> with C++1z auto-typed non-type template parameters"
>> seems to break some template specialization tricks at the core of
>> Boost.Hana
>> library.
>> The reduced example is:
>> 
>> $ cat hana.cpp
>> 
>> // SFINAE helpers.
>> 
>> template<bool Condition>
>> struct when;
>> 
>> template<typename...>
>> struct is_valid
>> {
>>    static constexpr bool value = true;
>> };
>> 
>> // A class and its tag.
>> 
>> struct c_tag;
>> 
>> struct C
>> {
>>    using tag = c_tag;
>> };
>> 
>> // Tag getter. When a type has a nested type "tag", it specifies its tag.
>> // When it doesn't have one, the tag is type itself.
>> 
>> template<typename T,typename = void>
>> struct tag_of : tag_of<T,when<true>> {};
>> 
>> template<typename T,bool Condition>
>> struct tag_of<T,when<Condition>>
>> {
>>    using type = T;
>> };
>> 
>> template<typename T>
>> struct tag_of<T,when<is_valid<typename T::tag>::value>>
>> {
>>    using type = typename T::tag;
>> };
>> 
>> // Attempt to calculate tag of C.
>> 
>> using tag_of_c = typename tag_of<C>::type;
>> 
>> 
>> $ clang++ -std=c++14 -fsyntax-only hana.cpp
>> 
>> hana.cpp:25:17: error: ambiguous partial specializations of 'tag_of<C,
>> when<true> >'
>> struct tag_of : tag_of<T,when<true>> {};
>>                ^
>> hana.cpp:41:27: note: in instantiation of template class 'tag_of<C,
>> void>'
>> requested here
>> using tag_of_c = typename tag_of<C>::type;
>>                          ^
>> hana.cpp:28:8: note: partial specialization matches [with T = C,
>> Condition =
>> true]
>> struct tag_of<T,when<Condition>>
>>       ^
>> hana.cpp:34:8: note: partial specialization matches [with T = C]
>> struct tag_of<T,when<is_valid<typename T::tag>::value>>
>>       ^
>> 1 error generated.
>> 
>> 
>> Is this a problem with the library or clang?
> 
> ---
> Pavel A. Lebedev
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list