[aspectc-user] Multiple definitions error with templates.

Olaf Spinczyk os at aspectc.org
Mon Jun 27 18:41:17 CEST 2011


Hi!

Your previous mail has been blocked by the mailing list software. The 
attachments were too big. It would be very kind if you submitted bug 
reports at www.aspectc.org/bugzilla.

Last week and this week we are improving a lot of template-related 
parser code. It is possible that these ongoing changes will solve the 
problem.

- Olaf

On 06/27/2011 05:59 PM, Guilherme . wrote:
> Hi!
>
> I am getting following error when trying to weave my code:
>
> include//click/hashmap.hh:219: error: invalid declaration near token 
> `template'
>
> Maybe this error has to do with the previously submitted email about 
> the conversion operator.
>
> Here is the offending code:
>
> 219 template <class K, class V>
> 220 inline
> 221 _HashMap_const_iterator<K, V>::operator unspecified_bool_type() const
> 222 {
> 223     return live() ? &_HashMap_const_iterator::live : 0;
> 224 }
>
> And the next one in this file:
>
> include//click/hashmap.hh:366: error: redefinition of `HashMap::begin'
> include//click/hashmap.hh:67: previously defined here
> include//click/hashmap.hh:534: error: redefinition of `HashMap::begin'
>
> The interesting part is, that it uses template specialization to (with 
> g++) avoid these errors.
>
> There are two classes defined.
>
> First:
>  24 template <class K, class V>
>  25 class HashMap { public:
>
> With forward declaration:
>  67   inline const_iterator begin() const;
>
> 115 };
>
> and later on:
>
> And the second class (the specializaton)
>
> 227 template <class K>
> 228 class HashMap<K, void *> { public:
>
> 318 };
>
> with these begin functions:
>
> 364 template <class K>
> 365 inline typename HashMap<K, void *>::const_iterator
> 366 HashMap<K, void *>::begin() const
> 367 {
> 368   return const_iterator(this, true);
> 369 }
>
> 532 template <class K, class T>
> 533 inline typename HashMap<K, T *>::const_iterator
> 534 HashMap<K, T *>::begin() const
> 535 {
> 536   return const_iterator(this, true);
> 537 }
>
> So i guess the specialization must be throwing the ac++ parser off...
>
> Anything i can do about it?
>
> Thank you for your help,
> Guilherme
>
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20110627/6ba9e172/attachment.html>


More information about the aspectc-user mailing list