ISO/ IEC JTC1/SC22/WG21 N0747

 
Accredited Standards Committee X3       Doc No: X3J16/95-0147R1 WG21/N0747R1
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 Linkage Issues  (Revision 1)
=======================================

o Linkage
========= 

 *Issue 473:
  ----------
  (linkage of local static variables)
 
  Replace 7.1.1 paragraph 4:
  "A name declared with a static specifier in a scope other than class
   scope (3.3.5) has internal linkage."
 
  with:
   "For the linkage of a name declared with a static specifier, see 3.5." 
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 *Issue 437:
  ----------
  (linkage of a block scope extern declaration linking with a previous 
   declaration)
 
  Replace 7.1.1 paragraph 5 third sentence with:
   "For the linkage of a name declared with an extern specifier, see 3.5." 

  Replace 3.5 paragraph 6 with:
    "The name of a function declared in block scope has linkage. 
     If the block scope function declaration matches a prior visible 
     declaration of the same function, the function name receives the linkage 
     of the previous declaration; otherwise, it receives external linkage. 

     The name of a variable declared extern in a block scope has linkage. 
     If this block scope declaration matches a prior visible declaration of the 
     same variable, the variable name receives the linkage of the previous 
     declaration; otherwise, it receives external linkage." 
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
 *Issue 461:
  ----------
  (namespace names have linkage)

  Add in 3.5 [basic.link] in paragraph 2, sentence 1, 'namespace' to the list
  of entities that have linkage.

  Add in 3.5 [basic.link] at the end of paragraph 4:
    -- a namespace (7.3), unless it is declared within an unnamed namespace.
 
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
o Names
=======
  (defines 'same name')
 
  Change 3 [basic] paragraph 8 to:
 
  "Two names are *the same* (with "the same" in italics) if
   -- they are identifiers composed with the same character sequences; or
   -- they are the names of overloaded operator functions formed with the
      same operator;
   -- they are the names of user-defined conversion functions formed with
      the same type.
   "
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
o Linking
=========
 
  Issue L1:
  ---------
  (describes how references, namespaces, and function templates are linked)

  In 3.5[basic.link]:
  o paragraph 2, add 'reference' to the list of entities.
  o paragraph 8, add 'reference' and 'namespace' to the list of entities.
  o paragraph 8, change 3rd bullet to:
    "both names denote functions, the function types are identical for
     purposes of overloading; and when both names denote function templates,
     the signatures (14.10.4) are the same."

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
  Issue L2:
  ---------
  (linkage of unnamed classes) 
   
  Replace 3.5 paragraph 4, bullet 3 with:
   "-- a named class, or an unnamed class defined in a typedef declaration 
       in which the class has the typedef name for linkage purposes (7.1.3); or 
    -- a named enumeration, or an unnamed enumeration defined in a typedef
       declaration in which the enumeration has the typedef name for linkage 
       purposes (7.1.3); or
    -- an enumerator belonging to an enumeration with external linkage; or 
   "
  
  Change 7.1.3 paragraph 5 to say:
   "If the typedef declaration defines an unnamed class (or enum), the first
    typedef-name declared by the declaration that is of class type (or enum 
    type) is used to denote the class type (or enum type) for linkage purposes 
    only (_basic.link_).

        typedef struct { } *ps, S; // 'S' is the class name for linkage purposes

    If the typedef-name is used where a class-name (or enum-name ) is required, 
    the program is ill-formed.

        typedef struct {
            S();    // error: requires a return type since S is
                    // an ordinary member function, not a constructor
        } S;
   "
    
  Delete 7.1.3 paragraph 6.
    
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
o Inline functions
==================
 
  Issue 454:
  ----------
  (two inline functions can call one another)
 
  The following sentence in 7.1.2 [dcl.fct.spec] paragraph 3 should be deleted:

    "A call to an inline function shall not precede its definition."

  together with the footnote and the example.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
o extern "LANG" issues
======================
 
  Issue 486:
  ----------
  Add to 7.5 [dcl.link] paragraph 2, after sentence 1:
    "When linkage specifications nest the innermost one determines the
     linkage".