struct->struct->class in C++ no constructor
Chris Jefferson
chris@bubblescope.net
Mon Jul 21 21:19:00 GMT 2008
2008/7/21 Wesley Smith <wesley.hoke@gmail.com>:
> Hi,
> I've encountered a problem in GCC 4.2.3 that didn't exist in GCC
> 4.0.x. Let's say I have:
>
> template<class T>
> Tube{
> public:
> Tube();
> ~Tube();
> };
>
> struct Graph {
> Tube<Ugen> t;
> }
>
> struct Clock {
> Graph g;
> }
>
> At issue is that Tube<T>'s constructor isn't getting called when Clock
> is allocated on the stack. Is this compliant with the C++ standard?
> I thought all classes had their constructors called when instantiated
> as an object even as members of structs. Any ideas?
Can you give a complete program which shows your problem?
Chris
More information about the Gcc-help
mailing list