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

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

Messages

Date: 2026-04-28.00:00:00

(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.
History
Date User Action Args
2026-04-28 00:00:00admincreate