Title
static_assert-declarations and general requirements for declarations
Status
c++11
Section
6.2 [basic.def]
Submitter
Alisdair Meredith

Created on 2008-02-12.00:00:00 last changed 123 months ago

Messages

Date: 2010-08-23.00:00:00

[Voted into WP at August, 2010 meeting.]

Date: 2010-03-15.00:00:00

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 static assertion (9.1 [dcl.pre]),

  • controlling template instantiation (13.9.3 [temp.explicit],

  • use of attributes (9.1 [dcl.pre], or

  • nothing (in the case of an empty-declaration).

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:...

Date: 2022-02-18.07:47:23

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?

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetstatus: wp -> fdis
2010-11-29 00:00:00adminsetstatus: dr -> wp
2010-08-23 00:00:00adminsetmessages: + msg2904
2010-08-23 00:00:00adminsetstatus: ready -> dr
2010-03-29 00:00:00adminsetstatus: review -> ready
2010-02-16 00:00:00adminsetmessages: + msg2520
2010-02-16 00:00:00adminsetstatus: drafting -> review
2008-06-29 00:00:00adminsetstatus: open -> drafting
2008-02-12 00:00:00admincreate