Con il codice seguente
#include<iostream>
using namespace std;
int main () {
int *a = new int[]{1,2,3};
for(int i = 0; i<3; ++i)
cout<<a[i]<<" ";
return 0;
}
non mi dà alcun errore:
g++ -Wall -fexceptions -g --version -c /mnt/Disco2/SviluppoSW/Allocazione/main.cpp -o obj/Debug/main.o
g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ -o bin/Debug/Allocazione obj/Debug/main.o
Output file is bin/Debug/Allocazione with size 28.24 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Comunque ho provato a compilare in Release e lì dà errore anche a me...