This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


313. Class with single conversion function to integral as array size in new

Section:  []     Status: dup     Submitter: Bill Gibbons     Date: 22 Oct 2001

Should it be allowed to use an object of a class type having a single conversion function to an integral type as an array size in the first bound of the type in an array new?

  struct A {
    operator int();
  } a;
  int main () {
    new int[a];

There are similar accommodations for the expression in a delete ( [expr.delete] paragraph 1) and in a switch (8.5.3 [stmt.switch] paragraph 2) . There is also widespread existing practice on this (g++, EDG, MSVC++, and Sun accept it, and even cfront 3.0.2).

Rationale (October, 2004):

Duplicate of issue 299.