Home | History | Annotate | Download | only in tests
      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 
     10 template <class T, class U>
     11 class 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 
     27 typedef  Stack<int,char>  Foo;
     28 typedef  Stack<Foo,Foo>  Foo2;
     29 typedef  Stack<Foo2,Foo2> Foo3;
     30 typedef  Stack<Foo3,Foo3> Foo4;
     31 typedef  Stack<Foo4,Foo4> Foo5;
     32 typedef  Stack<Foo5,Foo5> Foo6;
     33 typedef  Stack<Foo6,Foo6> Foo7;
     34 typedef  Stack<Foo7,Foo7> Foo8;
     35 typedef  Stack<Foo8,Foo8> Foo9;
     36 typedef  Stack<Foo9,Foo9> Foo10;
     37 typedef  Stack<Foo10,Foo10> Foo11;
     38 typedef  Stack<Foo11,Foo11> Foo12;
     39 
     40 int 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