cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.66k stars 748 forks source link

[expr.new] does not specify pointer value in case of an empty array allocation CWG2532 #3178

Open languagelawyer opened 5 years ago

languagelawyer commented 5 years ago

p5:

When the allocated object is not an array, the result of the new-expression is a pointer to the object created.

p6:

When the allocated object is an array (that is, the noptr-new-declarator syntax is used or the new-type-id or type-id denotes an array type), the new-expression yields a pointer to the initial element (if any) of the array.

p9:

When the value of the expression is zero, the allocation function is called to allocate an array with no elements.

IMO p9 (or p6) should specify what kind of pointer value ([basic.compound]) is produced by a new-expression allocating an array with no elements

jensmaurer commented 5 years ago

Editorial teleconference: Defer to CWG.

jensmaurer commented 5 years ago

Submitted to the CWG reflector: http://lists.isocpp.org/core/2019/09/7203.php