Title
Exporting a static_assert-declaration
Status
review
Section
10.2 [module.interface]
Submitter
Yexuan Xiao

Created on 2026-04-28.00:00:00 last changed 2 days ago

Messages

Date: 2026-05-30.06:06:38

Additional notes (2026-05-30)

Forwarded to EWG with paper issue #2802 for considering the design direction.

Date: 2026-05-15.00:00:00

Proposed resolution (May, 2026):

Change in 10.2 [module.interface] paragraph 1 as follows:

An export-declaration shall inhabit a namespace scope and appear in the purview of a module interface unit. An export-declaration shall not appear directly or indirectly within an unnamed namespace or a private-module-fragment. An export-declaration has the declarative effects of its name-declaration, declaration-seq (if any), or module-import-declaration. The name-declaration of an export-declaration shall not neither
  • be a static_assert-declaration, consteval-block-declaration, or empty-declaration, nor
  • declare a partial specialization (13.7.1 [temp.decls.general]).
The declaration-seq of an export-declaration shall not contain an export-declaration or module-import-declaration.
Date: 2026-05-30.06:06:38

(From submission #894.)

Consider:

  export static_assert(true);

This is syntactically valid, because export is followed by a name-declaration per 10.2 [module.interface] paragraph 1. One option for name-declaration is block-declaration (see 9.1 [dcl.pre] paragraph 1). One option for block-declaration is static_assert-declaration.

However, the additional export is entirely meaningless. Similar concerns apply to consteval-block-declaration and empty-declaration.

History
Date User Action Args
2026-05-30 06:06:38adminsetmessages: + msg8587
2026-05-20 07:13:21adminsetmessages: + msg8586
2026-05-20 07:13:21adminsetstatus: open -> review
2026-04-28 00:00:00admincreate