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

Eljay Love-Jensen eljay@adobe.com
Wed Jul 23 11:07:00 GMT 2008


Hi Wes,

Worked on my machine.  [See code below.]

Can you provide a compile-able example which illustrates the problem?

The example you provided was too abbreviated, and did not compile.

Thanks,
--Eljay

- - - -

#include <iostream>

template <typename T>
class Tube
{
public:
  Tube();
  ~Tube();
};

template <typename T>
Tube<T>::Tube()
{
  std::cerr << "Tube ctor\n";
}

template <typename T>
Tube<T>::~Tube()
{
  std::cerr << "Tube dtor\n";
}

typedef int Ugen;

struct Graph
{
  Tube<Ugen> t;
};

struct Clock
{
  Graph g;
};

void TestOnStack()
{
  Clock clock;
}

int main()
{
  TestOnStack();
}



More information about the Gcc-help mailing list