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

2026-05-01


3185. Exporting a static_assert-declaration

Section: 10.2  [module.interface]     Status: open     Submitter: Yexuan Xiao     Date: 2026-04-28

(From submission #894.)

Consider:

  export static_assert(true);

This is syntactically valid, because export is followed by a name-deeclaration 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.

Possible change:

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 or consteval-block-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.