Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


216. Linkage of nameless class-scope enumeration types

Section:6.7  [basic.link]    Status:CD1    Submitter:Daveed Vandevoorde    Date:13 Mar 2000

[Moved to DR at 10/01 meeting.]

6.7 [basic.link] paragraph 4 says (among other things):
A name having namespace scope has external linkage if it is the name of
That prohibits for example:
    typedef enum { e1 } *PE;    void f(PE) {}  // Cannot declare a function (with linkage) using a   // type with no linkage.

However, the same prohibition was not made for class scope types. Indeed,6.7 [basic.link] paragraph 5 says:

In addition, a member function, static data member, class orenumeration of class scope has external linkage if the name of theclass has external linkage.

That allows for:

    struct S {       typedef enum { e1 } *MPE;       void mf(MPE) {}    };

My guess is that this is an unintentional consequence of6.7 [basic.link] paragraph 5, but I would like confirmationon that.

Proposed resolution:

Change text in 6.7 [basic.link] paragraph 5 from:

In addition, a member function, static data member, class orenumeration of class scope has external linkage if the name of theclass has external linkage.
to:
In addition, a member function, a static data member, a named class orenumeration of class scope, or an unnamed class or enumeration definedin a class-scope typedef declaration such that the class orenumeration has the typedef name for linkage purposes(9.2.4 [dcl.typedef]),has external linkage if the name of the class has external linkage.



[8]ページ先頭

©2009-2026 Movatter.jp