[cfe-commits] r59232 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp

Zhongxing Xu xuzhongxing at gmail.com
Sat Nov 15 22:45:40 PST 2008


On Sun, Nov 16, 2008 at 1:24 PM, Ted Kremenek <kremenek at apple.com> wrote:

>
> On Nov 15, 2008, at 8:27 PM, Zhongxing Xu wrote:
>
>
>
> On Sun, Nov 16, 2008 at 11:28 AM, Ted Kremenek <kremenek at apple.com> wrote:
>
>>
>> On Nov 15, 2008, at 5:55 AM, Zhongxing Xu wrote:
>>
>>
>>> One side problem is that I cannot make the MemRegion* in the
>>> ImmutableList const. If I did that, I would get compile error, related to
>>> FoldingSet Profile() overloading.
>>>
>>> It seems that ImmutableList cannot take a const type as template
>>> parameter, otherwise the  two Profile functions in the partial
>>> specialization of FoldingSetTrait would have the same signature.
>>> (FoldingSet.h:444, 447).
>>>
>>
>> Could we provide a partial specialization of FoldingSetTrait just for
>> ImmutableList?  Or, does (something like) this work (i.e., add another
>> partial specialization for const types):
>>
>> template<typename const T> struct FoldingSetTrait<const T*> {
>>  static inline void Profile(const T* X, FoldingSetNodeID& ID) {
>>    ID.AddPointer(X);
>>  }
>> };
>>
>
> Yeah, this works! Thanks. Incidentally, do you think the old problem is
> caused by a g++ bug, because, at FoldingSet.h:234, the parameter for Add()
> already contains 'const', T should not contain 'const' when being
> instantiated.
>
>
> On 234 we have:
>
>   template <typename T>
>   inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }
>
> maybe we just add partial specialization:
>
>   template <typename const T>
>   inline void Add(const T& x) { FoldingSetTrait<T>::Profile(x, *this); }
>

This is not compilable. We cannot have 'const' in template parameter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081116/0ec335b1/attachment.html>


More information about the cfe-commits mailing list