ISO/ IEC JTC1/SC22/WG21 N0748

Accredited Standards Committee X3       Doc No: X3J16/95-0148R1 WG21/N0748R1
Information Processing Systems          Date:    Jul 12, 1995   
Operating under the procedures of       Project: Programming Language C++
American National Standards Institute   Ref Doc: 
                                        Reply to: Josee Lajoie
                                                  (josee@vnet.ibm.com)


Proposed Resolutions for Issues on new and delete (Revision 1)
=================================================

 *Issue 463:
  ----------
  (allocation functions must be declared in global scope or in class scope)

  change 3.7.3.1[basic.stc.dynamic.allocation] paragraph 1, 1st sentence to 
  say:
    "Allocation functions shall be class member functions or
     global functions; a program is ill-formed if allocation functions are 
     declared in a namespace scope other than global scope or declared 
     static in global scope."
 
  3.7.3.2[basic.src.dynamic.deallocation] paragraph 1 should be changed
  to say:
    "Deallocation functions shall be class member functions or global 
     functions; a program is ill-formed if deallocation functions are 
     declared in a namespace scope other than global scope or declared 
     static in global scope."
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 *Issue 450:
  ----------
  (look up of class operator new/delete)

  Replace 12.5[class.free] paragraph 2 with:
    "When a new expression is used to create an object of class T (or array 
     thereof), the allocation function is looked up in the scope of
     class T; if no allocation function is found, the global allocation 
     function is used."
 
  Replace 12.5[class.free] paragraph 7 with:
    "When a delete expression is used to delete an object or array,
     the deallocation function is looked up in the scope of the class of the 
     executed destructor; if no deallocation function is found, the global 
     deallocation function is used."
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 *Issue 469:
  ---------
  Add to 5.3.4 [expr.new] paragraph 10:
  "When the keyword new in a new expression is preceeded by the unary
   '::' operator, the global allocation function is used to allocate the
   storage."
 
  Add to 5.3.5 [expr.delete] paragraph 8:
  "When the keyword delete in a delete expression is preceeded by the
   unary '::' operator, the global deallocation function is used to
   deallocate the storage."
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 *Issue 435:
  ----------
  Indicate that reference types cannot be newed.

  During the editorial session in Monterey, it was decided that 
  '&' should be allowed by the syntax, and that new'ing reference types 
  should be disallowed on semantic grounds (instead of syntactic grounds).

  Disallowing new'ing reference types on semantic grounds is needed since a 
  reference type can be introduced via a typedef.

  Changing the syntax to allow '&' ensures that code parses the same
  whether '&' or '*' is used. This is more consistent for users.
  Otherwise, if the syntax omits the '&' as part of the new expression, the
  following expression:

    new int & t;

  parses correctly, and the expression could have valid meaning depending on
  the type of t. Yuck.
  This would be very confusing for users. 

  Proposed changes:
    Change the grammar as follows:
       new-declarator:
           ptr-operator new-declarator(opt)
           direct-new-declarator

    After the following sentence in the 1st paragraph:
      "This type shall be a complete nonabstract object type or array type
       (_intro.object_, _basic.types_, _class.abstract_)."
    Add the following note:
      "Note: because references are not objects, references cannot be 
       created with new-expressions."
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .