example7.cpp 352 B

123456789101112131415
  1. int main() {
  2. int *pi;
  3. int i;
  4. #ifdef DUMA_EXPLICIT_INIT
  5. duma_init();
  6. #endif
  7. pi = new int[10];
  8. for (i = 0; i < 10; ++i)
  9. pi[i] = i;
  10. delete pi; // lgtm[cpp/new-array-delete-mismatch]
  11. // above line should produce error, cause pi was allocated with new[]()
  12. // unable to report allocation source - without including dumapp.h
  13. return 0;
  14. }