1// { dg-do assemble } 2// Bug: new doesn't make sure that the count is an integral value. 3 4#include <new> 5extern "C" int printf (const char *, ...); 6extern "C" void *malloc (size_t); 7size_t s; 8 9void * 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 17int 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} 27