Title
Export of typedef after its first declaration
Status
cd6
Section
10.2 [module.interface]
Submitter
Richard Smith

Created on 2021-04-16.00:00:00 last changed 20 months ago

Messages

Date: 2021-11-15.00:00:00

Proposed resolution, August, 2021:

Change 10.2 [module.interface] paragraph 6 as follows:

A redeclaration of an entity or typedef-name X is implicitly exported if X was introduced by an exported declaration; otherwise it shall not be exported.
Date: 2021-10-15.00:00:00

[Accepted as a DR at the October, 2021 meeting.]

According to 10.2 [module.interface] paragraph 6,

A redeclaration of an entity or typedef-name X is implicitly exported if X was introduced by an exported declaration; otherwise it shall not be exported. [Example 4:

  export module M;
  struct S { int n; };
  typedef S S;
  export typedef S S; // OK, does not redeclare an entity
  export struct S;    // error: exported declaration follows non-exported declaration

end example]

The normative text says that exporting a typedef that was not exported on its first declaration is ill-formed, but the example does so and states that it is “OK”. This is a contradiction that was introduced by the changes in paper P1787R6; the previous normative text supported the usage in the example.

(See also editorial issue 4540.)

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2022-02-15 00:00:00adminsetstatus: dr -> drwp
2021-11-15 00:00:00adminsetmessages: + msg6576
2021-04-16 00:00:00admincreate