1 2/* Point of this test is to generate some very long 'stabs' debug 3 strings, via the use of these exponentially large template types. 4 When compiled with -gstabs, this causes 3.1.1 to segfault at 5 startup. 6*/ 7 8#include <stdio.h> 9 10template <class T, class U> 11class Stack 12{ 13 public: 14 Stack(int = 10) { size=5; top=6; stackPtr=(T*)6; }; 15 ~Stack() { } 16 int push(const T&, const U&); 17 int popT(T&); 18 int popU(U&); 19 int isEmpty() const { return top == -1; } 20 int isFull() const { return top == size - 1; } 21 private: 22 int size; 23 int top; 24 T* stackPtr; 25} ; 26 27typedef Stack<int,char> Foo; 28typedef Stack<Foo,Foo> Foo2; 29typedef Stack<Foo2,Foo2> Foo3; 30typedef Stack<Foo3,Foo3> Foo4; 31typedef Stack<Foo4,Foo4> Foo5; 32typedef Stack<Foo5,Foo5> Foo6; 33typedef Stack<Foo6,Foo6> Foo7; 34typedef Stack<Foo7,Foo7> Foo8; 35typedef Stack<Foo8,Foo8> Foo9; 36typedef Stack<Foo9,Foo9> Foo10; 37typedef Stack<Foo10,Foo10> Foo11; 38typedef Stack<Foo11,Foo11> Foo12; 39 40int main ( int argc, char** argv ) 41{ 42 Stack<Foo12,Foo12> * x = new Stack<Foo12,Foo12>(3); 43 if (x == NULL) 44 printf("It's NULL (?!)\n"); 45 else 46 printf("It's not NULL. How DULL.\n"); 47 delete x; 48 return 0; 49} 50