struct->struct->class in C++ no constructor

John Fine johnsfine@verizon.net
Mon Jul 21 21:23:00 GMT 2008


Can you provide a complete example?

As you described it, the constructor should be called.  But you haven't 
given enough information for anyone to duplicate the situation in which 
the constructor isn't called.

Was the definition of the constructor provided in the same compilation 
or was it external?  If provided, how do you know it wasn't called 
(possibly inlined and optimized to the point that you wouldn't know)?

Wesley Smith wrote:
>
> 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?
>
>
>   



More information about the Gcc-help mailing list