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

2024-12-19


676. static_assert-declarations and general requirements for declarations

Section: 6.2  [basic.def]     Status: C++11     Submitter: Alisdair Meredith     Date: 12 February, 2008

[Voted into WP at August, 2010 meeting.]

6.2 [basic.def] makes statements about declarations that do not appear to apply to static_assert-declarations. For example, paragraph 1 says,

A declaration (9.1 [dcl.pre]) introduces names into a translation unit or redeclares names introduced by previous declarations. A declaration specifies the interpretation and attributes of these names.

What name is being declared or described by a static_assert-declaration?

Also, paragraph 2 lists the kinds of declarations that are not definitions, and a static_assert-declaration is not among them. Is it intentional that static_assert-declarations are definitions?

Proposed resolution (March, 2010):

Change 6.2 [basic.def] paragraphs 1-2 as follows:

A declaration (9.1 [dcl.pre]) may introduces one or more names into a translation unit or redeclares names introduced by previous declarations. A If so, the declaration specifies the interpretation and attributes of these names. A declaration may also have effects including

A declaration is a definition unless it declares a function without specifying the function's body (9.5 [dcl.fct.def]), it contains the extern specifier (9.2.2 [dcl.stc]) or a linkage-specification25 (9.11 [dcl.link]) and neither an initializer nor a function-body, it declares a static data member in a class definition (11.4.9 [class.static]), it is a class name declaration (11.3 [class.name]), it is an opaque-enum-declaration (9.7.1 [dcl.enum]), or it is a typedef declaration (9.2.4 [dcl.typedef]), a using-declaration (9.9 [namespace.udecl]), a static_assert-declaration (9.1 [dcl.pre]), an attribute-declaration (9.1 [dcl.pre]), an empty-declaration (9.1 [dcl.pre]), or a using-directive (9.8.4 [namespace.udir]). [Example:...