FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.jason / new.C
blobce8656960785b94e373f20185d894ce07ee825bd
1 // Bug: new doesn't make sure that the count is an integral value.
3 #include <new>
4 extern "C" int printf (const char *, ...);
5 extern "C" void *malloc (size_t);
6 size_t s;
8 void * operator new (size_t siz) throw (std::bad_alloc) {
9   if (s == 0)
10     s = siz;
11   else
12     s = (s != siz);
13   return malloc (siz);
16 int main()
18   s = 0;
20   float f = 3;
21   int* b1 = new int[(int)f];
22   int* b2 = new int[f];         // ERROR - new requires integral size
24   return s;