[llvm] r273223 - Use the same tag type across all PointerLikeTypeTraits specializations

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 00:01:27 PDT 2016


On Mon, Jun 20, 2016 at 11:44 PM, Chandler Carruth via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> On Tue, Jun 21, 2016 at 2:57 AM Reid Kleckner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: rnk
>> Date: Mon Jun 20 18:50:21 2016
>> New Revision: 273223
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=273223&view=rev
>> Log:
>> Use the same tag type across all PointerLikeTypeTraits specializations
>>
>> Works around a bug (PR28216) in Clang's MS mangling of templates with
>> partial specializations.
>>
>> This mismatch was introduced in about six months ago in r256656.
>>
>
> Thanks.
>
> Also, UGH.
>
> Don't we have a warning to catch this? Can we turn it on if we're going to
> have to care?
>

-Wmismatched-tags seems closest but it doesn't seem to fire for
partial/full specializations.


>
> (I'd much rather not care, but I understand that MS's ABI has made that
> impossible?)
>

Yes, the MSVC ABI encodes the class-key into the mangled name.


>
>
>>
>> Modified:
>>     llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
>>
>> Modified: llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h?rev=273223&r1=273222&r2=273223&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h (original)
>> +++ llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h Mon Jun 20
>> 18:50:21 2016
>> @@ -37,7 +37,8 @@ template <> struct ConstantLog2<1> : std
>>  }
>>
>>  // Provide PointerLikeTypeTraits for non-cvr pointers.
>> -template <typename T> struct PointerLikeTypeTraits<T *> {
>> +template <typename T> class PointerLikeTypeTraits<T *> {
>> +public:
>>    static inline void *getAsVoidPointer(T *P) { return P; }
>>    static inline T *getFromVoidPointer(void *P) { return static_cast<T
>> *>(P); }
>>
>> @@ -46,7 +47,8 @@ template <typename T> struct PointerLike
>>    };
>>  };
>>
>> -template <> struct PointerLikeTypeTraits<void *> {
>> +template <> class PointerLikeTypeTraits<void *> {
>> +public:
>>    static inline void *getAsVoidPointer(void *P) { return P; }
>>    static inline void *getFromVoidPointer(void *P) { return P; }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160621/402245f3/attachment.html>


More information about the llvm-commits mailing list