void *operatornew(size_t x, int qual) MOZ_HEAP_ALLOCATOR { return ::operatornew(x);
}
template <typename T>
T *customAlloc() MOZ_HEAP_ALLOCATOR {
T *arg = static_cast<T*>(malloc(sizeof(T))); returnnew (arg) T();
}
void misuseX() {
X *foo = customAlloc<X>(); // expected-error {{variable of type 'X' is not valid on the heap}} expected-note {{value incorrectly allocated on the heap}}
X *foo2 = new (100) X(); // expected-error {{variable of type 'X' is not valid on the heap}} expected-note {{value incorrectly allocated on the heap}}
}
Messung V0.5
[ zur Elbe Produktseite wechseln0.14Quellennavigators
Analyse erneut starten
]