https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77804
Bug ID: 77804
Summary: Internal compiler error on incorrect initialization of
new-d array
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vgheorgh at gmail dot com
Target Milestone: ---
The code below
#include <new>
int main()
{
char buf[256];
std::size_t n = 10;
int* p = new (buf) (int[n]); // incorrect way, parenthesis by mistake
// int* p = new (buf) int[n]; // correct way
}
produces an internal compile error in gcc versions 6 or later. It compiles fine
(although with an warning: non-constant array new length must be specified
without parentheses around the type-id [-Wvla].