pt ctor ordering/missing ctor
Mike Stump
mrs@wrs.com
Tue Oct 13 18:28:00 GMT 1998
Aconstructor is never even called, and it should be. I'm not exactly
sure what the best right order is for the below, do you (to Jason and
Mark) have a preference? I wasn't sure if the standard mandated a
particular ordering or not, andbody able to cite something relevant?
extern "C" int printf (const char *, ...);
template <class T>
struct S {
S () {printf ("Constructing S with sm at %x\n", &sm);}
static T sm;
};
template <class T> T S<T>::sm;
struct O { O () {printf ("Constructing!");}};
struct A : O{ A() { Aconstructor ();}};
struct B : O{};
struct C : O{};
struct D : O{};
struct E : O{};
struct F : O{};
struct G : O{};
struct H : O{};
int first=_first (); // 1
S<A> sa; // 2
S<B> sb; // 3
int mid=_mid (); // 4
template C S<C>::sm; // 8 (sm)
G S<G>::sm; // 5
H S<H>::sm; // 6
template S<E>; // 9 (sm)
template D S<D>::sm; // 10 (sm)
template S<F>; // 11 (sm)
int last=_last (); // 7
More information about the Gcc-bugs
mailing list