1 // { dg-options "-std=c++0x -fabi-version=0" } 2 new(__SIZE_TYPE__,void * p)3void* operator new (__SIZE_TYPE__, void *p) { return p; } 4 int i; 5 6 template <unsigned int> struct helper {}; 7 // { dg-final { scan-assembler "_Z6check1IiEvP6helperIXsznw_T_EEE" } } check1(helper<sizeof (new T)> *)8template <class T> void check1( helper<sizeof(new T)> * ) { } 9 // { dg-final { scan-assembler "_Z6check2IiEvP6helperIXszgsnw_T_piEEE" } } check2(helper<sizeof (::new T ())> *)10template <class T> void check2( helper<sizeof(::new T())> * ) { } 11 // { dg-final { scan-assembler "_Z6check3IiEvP6helperIXsznwadL_Z1iE_T_piLi1EEEE" } } check3(helper<sizeof (new (& i)T (1))> *)12template <class T> void check3( helper<sizeof(new (&i) T(1))> * ) { } 13 // { dg-final { scan-assembler "_Z7check3aIiEvP6helperIXsznw_T_ilLi1EEEE" } } check3a(helper<sizeof (new T{1})> *)14template <class T> void check3a( helper<sizeof(new T{1})> * ) { } 15 // { dg-final { scan-assembler "_Z6check4IiEvP6helperIXszna_A1_T_EEE" } } check4(helper<sizeof (new T[1])> *)16template <class T> void check4( helper<sizeof(new T[1])> * ) { } 17 // { dg-final { scan-assembler "_Z6check5IiEvP6helperIXszna_A1_T_piEEE" } } check5(helper<sizeof (new T[1]())> *)18template <class T> void check5( helper<sizeof(new T[1]())> * ) { } main()19int main() 20 { 21 check1<int>(0); 22 check2<int>(0); 23 check3<int>(0); 24 check3a<int>(0); 25 check4<int>(0); 26 check5<int>(0); 27 } 28