In C++14 given the following code:
void foo() {
double d = 5.0;
auto p1 = new int[d];
}
clang compiles this without diagnostic while gcc on the other hand produces the following diagnostic (see it live in godbolt):
error: expression in new-declarator must have integral or enumeration type
7 | auto p1 = new int[d];
| ^
I specifically labeled this C++14 because in C++11 mode clang treats this as ill-formed and produces the following diagnostic (see it live in godbolt):
error: array size expression must have integral or unscoped enumeration type, not 'double'
auto p1 = new int[d];
^ ~
Is clang correct? If so what changed in C++14 to allow this?