| 1 |
// { dg-do assemble } |
| 2 |
// GROUPS passed operators |
| 3 |
#include <sys/types.h> |
| 4 |
#include <stdio.h> |
| 5 |
|
| 6 |
class new_test |
| 7 |
{ |
| 8 |
int type; |
| 9 |
public: |
| 10 |
void* operator new(size_t sz, int count, int type); |
| 11 |
}; |
| 12 |
|
| 13 |
void* new_test::operator new(size_t sz, int count, int type) |
| 14 |
{ |
| 15 |
void *p; |
| 16 |
|
| 17 |
printf("%d %d %d\n", sz, count, type); |
| 18 |
|
| 19 |
p = new char[sz * count]; |
| 20 |
((new_test *)p)->type = type; |
| 21 |
return p; |
| 22 |
} |
| 23 |
|
| 24 |
int main() |
| 25 |
{ |
| 26 |
new_test *test; |
| 27 |
int count = 13; |
| 28 |
|
| 29 |
test = new(count, 1) new_test; |
| 30 |
} |