Missing cases of declarations that are not definitions
6.2 [basic.def]
Bjarne Stroustrup

Created on 2009-01-22.00:00:00 last changed 96 months ago


Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010) [SUPERSEDED]:

Change 6.2 [basic.def] paragraph 2 as follows:

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 [class.mem], 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]), it is a template-parameter (13.2 [temp.param]), it is a parameter-declaration ( [dcl.fct]) in a function declaration that is not a definition, or it is a typedef declaration (9.2.4 [dcl.typedef]), an alias-declaration (9.2.4 [dcl.typedef]), a using-declaration (9.9 [namespace.udecl]), a static_assert-declaration (Clause Clause 9 [dcl.dcl]), an attribute-declaration (Clause Clause 9 [dcl.dcl]), an empty-declaration (Clause Clause 9 [dcl.dcl]), or a using-directive (9.8.4 [namespace.udir]).
Date: 2020-12-15.00:00:00
N2800 comment UK 23
N2800 comment UK 24

The list of declarations that are not definitions given in 6.2 [basic.def] paragraph 2 does not mention several plausible candidates: parameter declarations in non-defining function declarations, non-static data members, and template parameters. It might be argued that none of these are declarations (paragraph 1 does not use the syntactic non-terminal declaration but does explicitly refer to clause Clause 9 [dcl.dcl], where that non-terminal is defined). However, the list in paragraph 2 does mention static member declarations, which also are not declarations, so the intent is not clear.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3287
2011-04-10 00:00:00adminsetstatus: review -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3066
2010-11-29 00:00:00adminsetstatus: open -> review
2009-01-22 00:00:00admincreate