Hi,
Since I wouldn’t categorise the following as a bug, I instead chose to describe by experience here, rather than in a bug report.
I’m trying to do something quite complicated. I define a class with the following structure:
[code]template< class T1 >
class A {
…
private:
template< class T2 >
class B : public TNamed {
…
};
B< T1 > member;
};[/code]
You’ll have to trust me that for the problem that I’m trying to solve this would be a very elegant solution. As you can see, the internal class inherits from TNamed, because I want to be able to stream it over the network in a PROOF session.
So now I’m trying to create a dictionary for class A with a few template argument types. (int, short, etc.) Unfortunately rootcint can’t understand my code correctly, so the generated dictionary source can’t be compiled.
I’ve been trying to play with how I declare the “member” variable, but even if I fully qualify it like
in its declaration, it is still put as
in the shadow class in the dictionary source. Since the shadow class has nothing to do with class A, this declarations doesn’t specify the internal class to gcc.
Of course the solution seems straightforward enough: I just have to get the declaration of B< T2 > out of A< T1 >, and make it a stand-alone class. But from a design point of view it would’ve been nicer if it could’ve been hidden.
I know ROOT is not too fond of using templated code heavily, so I don’t think anyone is to blame for not thinking of such a weird setup for generating a dictionary. I just wanted to report a restriction of rootcint, hoping that maybe at one point it could become able to handle such code. It’s already almost able to generate the correct code, I just have to correct this one line in the generated dictionary by hand, and it compiles.
Cheers,
Attila