2 // { dg-options "-O2 -Warray-bounds" }
7 virtual unsigned long length() const = 0;
8 virtual char get(unsigned long index) const = 0;
9 virtual void set(unsigned long index, char value) = 0;
10 virtual char& operator[] (unsigned long value) = 0;
14 template<unsigned long size> class FixedString : public String
20 virtual unsigned long length() const { return size; }
21 virtual char get(unsigned long index) const { return contents[index]; }
22 virtual void set(unsigned long index, char value) { contents[index] = value; }
23 virtual char& operator[] (unsigned long index) { return contents[index]; }
25 FixedString() { contents[0] = '\0'; } // { dg-warning "above array bounds" }
28 void print_length (const String& string);
32 const FixedString<0> empty;