template instantiation loop & internal error

Alex Achenbach A.Achenbach@em.uni-frankfurt.de
Thu Dec 24 07:10:00 GMT 1998


Merry Christmas.

I recently came across two problems concerning egcs 1.1.1.

One ("template-loop") is about some kind of infinite instantiation
loop arising from a reference loop in static members of a template
class.

The other ("internal-error") concerns initialization of static
const members containing pointers.

Cheers (and a hny)

Alex
# 1 "template-loop.cc"
template <class A> class T {
public:
    struct P { const P *p1, *p2; };

    static P pa;
    static P pb;
    static P pc;
    
    const P *pp;

    T() : pp (&pa) { }
};
template <class A> T<A>::P T<A>::pa = { &T<A>::pb, &T<A>::pc };
template <class A> T<A>::P T<A>::pb = { &T<A>::pc, &T<A>::pa };
template <class A> T<A>::P T<A>::pc = { &T<A>::pa, &T<A>::pb };

int main() {
    T<int> t;
  
    return 0;
}


More information about the Gcc-bugs mailing list