RE: [sigc] Problem with accumulator when signal depend on templateparameter



David Eriksson wrote:
> template <class T>
> class MyTemplate
> {
> public:
>   typedef sigc::signal1<int, T, Accumulator> MySignalType1; 
> 
>   typedef sigc::signal<int, T>::accumulated<Accumulator>
>     MySignalType;   
> };

> When I compile with gcc (GCC) 3.3.5 (Debian 1:3.3.5-8ubuntu2):
> 
> crash-gcc.cc: In instantiation of `MyTemplate<void*>':
> crash-gcc.cc:21:   instantiated from here
> crash-gcc.cc:16: internal compiler error: Segmentation fault Please
> submit a full bug report, 

OK, this clearly should not happen, though it may be triggered by bad code.

> When I compile with gcc-4.0 (GCC) 4.0.0 20050301 (prerelease) (Debian
> 4.0-0pre6ubuntu7):
> 
> crash-gcc.cc:16: error: non-template ‘accumulated’ used as template
> crash-gcc.cc:16: note: use ‘sigc::signal<int, T, sigc::nil,
> sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::template
> accumulated’ to indicate that it is a template 

There are cases where such a syntax is really required, though I can't tell you exactly when and why. Have you tried adding the 'template' to the typedef, like

  typedef sigc::signal<int, T>::template accumulated<Accumulator> MySignalType;

I believe that it is somehow similar to the case where a 'typename' is required when referring to a type nested in a dependent type. If you want a real answer, I'd suggest taking this to the Usenet, comp.lang.c++.moderated to be precise.

> The suggestion on the second line from gcc 4 does not make any sense
> to me, and gives even more errors if I try it. 

Hmmm, what are those? More errors doesn't means something is more wrong, in particular with compilers. ;)

Uli



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]