4.14 The new Operator

A new operation has one of the following forms:

  1. new C
  2. new C ( ... )
  3. new C < ... > ( ... )

where C is an expression. The first form is equivalent to supplying an empty argument list. C must be of type Any or of an object type with one or more construct or call signatures. The operation is processed as follows at compile-time:

  • If C is of type Any, any argument list is permitted and the result of the operation is of type Any.
  • If C has one or more apparent construct signatures (section 3.11.1), the expression is processed in the same manner as a function call, but using the construct signatures as the initial set of candidate signatures for overload resolution. The result type of the function call becomes the result type of the operation.
  • If C has no apparent construct signatures but one or more apparent call signatures, the expression is processed as a function call. A compile-time error occurs if the result of the function call is not Void. The type of the result of the operation is Any.