gcc/testsuite/g++.old-deja/g++.law/bad-error6.C
raw| 1 | // { dg-do assemble } |
| 2 | // GROUPS passed bad-errors |
| 3 | typedef __SIZE_TYPE__ size_t; |
| 4 | |
| 5 | class tt { |
| 6 | public: |
| 7 | tt(int); |
| 8 | |
| 9 | private: |
| 10 | void *operator new(size_t a); // Forbid object creation in heap memory. |
| 11 | }; |
| 12 | |
| 13 | void st(const tt&, int); |
| 14 | |
| 15 | void ff(int i, int j) |
| 16 | { |
| 17 | if( i > 0 ) { |
| 18 | // This work ok. |
| 19 | tt a_tt(i); |
| 20 | st(a_tt, j); |
| 21 | } |
| 22 | else { |
| 23 | // This triggers an error because of private operator new ????. |
| 24 | st(tt(-i), j); |
| 25 | } |
| 26 | } |