OSDN Git Service

* lib/g++-dg.exp (g++-dg-test): Add "repo" option.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.jason / new.C
1 // { dg-do assemble  }
2 // Bug: new doesn't make sure that the count is an integral value.
3
4 #include <new>
5 extern "C" int printf (const char *, ...);
6 extern "C" void *malloc (size_t);
7 size_t s;
8
9 void * operator new (size_t siz) throw (std::bad_alloc) {
10   if (s == 0)
11     s = siz;
12   else
13     s = (s != siz);
14   return malloc (siz);
15 }
16
17 int main()
18 {
19   s = 0;
20
21   float f = 3;
22   int* b1 = new int[(int)f];
23   int* b2 = new int[f];         // { dg-error "" } new requires integral size
24
25   return s;
26 }