http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60423
Bug ID: 60423
Summary: g++ can treat a dynamic POD variable as an array
without warning/error
Product: gcc
Version: trans-mem
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: peter.bocan at azet dot sk
Hello guys, we had at university this issue: compiling the code below, throws
no error messages whatsoever, but the code is, as you know, not working. It's,
at least for me, that compiler would recognize this type of mistakes and so it
would be kinda nice to have some type checking upon POD types.
The code is:
int main()
{
int* pod_type = new int(23);
for (int i = 0; i < 10000; i++)
pot_type[i] = 0xDEADC0DE;
delete pod_type;
return 0;
}
Thank you.