https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91261
Bug ID: 91261
Summary: noptr-new-declarator does not accept converted
constant expressions
Product: gcc
Version: 8.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: smw at gcc dot gnu.org
Target Milestone: ---
The restrictions on the constant-expression of noptr-new-devlarators was
changed from integral constant expressions in C++11 to converted constant
expressions in C++14 [expr.new] 5.3.4/6. GCC rejects non-integral expressions
with the message "error: expression in new-declarator must have integral or
enumeration type".
Reproducer follows.
int main() {
void* p26 = new int [1.0f][3];
}
Confirmed in GCC 8.3, 9.1, and trunk.