Created on2011-12-24.00:00:00 last changed145 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (October, 2012):
Change 9.3.4 [dcl.meaning] paragraph 1 as follows:
A list of declarators appears after an optional (9.1 [dcl.pre])decl-specifier-seq (9.2 [dcl.spec]). Each declaratorcontains exactly onedeclarator-id; it names the identifierthat is declared. Anunqualified-id occurring in adeclarator-id shall be a simpleidentifier except forthe declaration of some special functions (11.4.5 [class.ctor], 11.4.8 [class.conv], 11.4.7 [class.dtor], 12.4 [over.oper]) and for the declaration oftemplate specializations or partial specializations (13.9 [temp.spec]). Adeclarator-id shall not...
Change 11.4.5 [class.ctor] paragraph 1 as follows:
Constructors do not have names.
A special declarator syntax isused to declare or define the constructor. The syntax uses:
an optionaldecl-specifier-seq in which eachdecl-specifier is either afunction-specifier orconstexpr,
the constructor's class name, and
a parameter list
in that order. In such a declaration, optional parenthesesaround the constructor class name are ignored.Adeclaration of a constructor uses a function declarator (9.3.4.6 [dcl.fct]) of the formptr-declarator(parameter-declaration-clause)exception-specificationopt attribute-specifier-seqopt
where theptr-declarator consists solely of anid-expression, an optionalattribute-specifier-seq, andoptional surrounding parentheses, and theid-expression hasone of the following forms:
in amember-declaration that belongs to themember-specification of a class but is not a friend declaration(11.8.4 [class.friend]), theid-expression is theinjected-class-name (Clause 11 [class]) of theimmediately-enclosing class;
in amember-declaration that belongs to themember-specification of a class template but is not a frienddeclaration, theid-expression is aclass-name thatnames the current instantiation (13.8.3.2 [temp.dep.type]) of theimmediately-enclosing class template; or
in a declaration at namespace scope or in a friend declaration, theid-expression is aqualified-id that names a constructor(6.5.5.2 [class.qual]).
Theclass-name shall not be atypedef-name. In a constructor declaration, eachdecl-specifier in the optionaldecl-specifier-seq shallbefriend,inline,explicit, orconstexpr. [Example:...
Delete 11.4.5 [class.ctor] paragraph 3:
Atypedef-name shall not be used as theclass-name inthedeclarator-id for a constructor declaration.
Change 11.4.5 [class.ctor] paragraph 4 as follows:
A constructor shall not bevirtual (11.7.3 [class.virtual]) orstatic (11.4.9 [class.static]).Aconstructor can be invoked for aconst,volatile orconst volatile object.A constructor shall not bedeclaredconst,volatile, orconst volatile(_N4868_.11.4.3.2 [class.this]).const andvolatile semantics (9.2.9.2 [dcl.type.cv]) are notapplied on an object under construction. They come into effect whenthe constructor for the most derived object (6.8.2 [intro.object])ends.A constructor shall not be declared with aref-qualifier.
Change 11.4.5 [class.ctor] paragraph 9 as follows:
No return type (not evenvoid) shall be specified for aconstructor.Areturn statement in the body of aconstructor shall not specify a return value. The address of aconstructor shall not be taken.
Change 11.4.7 [class.dtor] paragraphs 1-2 as follows:
A special declarator syntax using an optionalfunction-specifier (9.2.3 [dcl.fct.spec]) followed by~ followed by the destructor's class name followed by anempty parameter list is used to declare the destructor in a classdefinition. In such a declaration, the~ followed by thedestructor's class name can be enclosed in optional parentheses; suchparentheses are ignored. Atypedef-name shall not be used asthe class-name following the~ in the declarator for adestructor declaration.A declaration of a destructor uses afunction declarator (9.3.4.6 [dcl.fct]) of the formptr-declarator(parameter-declaration-clause)exception-specificationopt attribute-specifier-seqopt
where theptr-declarator consists solely of anid-expression, an optionalattribute-specifier-seq,and optional surrounding parentheses, and theid-expression hasone of the following forms:
in amember-declaration that belongs to themember-specification of a class but is not a friend declaration(11.8.4 [class.friend]), theid-expression is~class-name and theclass-name is theinjected-class-name (Clause 11 [class]) of theimmediately-enclosing class;
in amember-declaration that belongs to themember-specification of a class template but is not a frienddeclaration, theid-expression is~class-name and theclass-name names the current instantiation (13.8.3.2 [temp.dep.type]) of the immediately-enclosing class template;or
in a declaration at namespace scope or in a friend declaration, theid-expression isnested-name-specifier~class-name and theclass-name names the sameclass as thenested-name-specifier.
Theclass-name shall not be atypedef-name. Adestructor shall take no arguments (9.3.4.6 [dcl.fct]). In adestructor declaration, eachdecl-specifier of the optionaldecl-specifier-seq shall befriend,inline,orvirtual.
A destructor is used to destroy objects of its class type.
Adestructor takes no parameters, and no return type can be specifiedfor it (not evenvoid).The address of a destructorshall not be taken.A destructor shall not bestatic.A destructor can be invoked for aconst,volatile orconst volatileobject.A destructor shall not be declaredconst,volatile orconst volatile (_N4868_.11.4.3.2 [class.this]).const andvolatile semantics(9.2.9.2 [dcl.type.cv]) are not applied on an object underdestruction. They stop being in effect when the destructor for themost derived object (6.8.2 [intro.object]) starts.Adestructor shall not be declared with aref-qualifier.
This resolution also resolvesissue 344.
The status of a declaration like the following is unclear:
template<typename T> struct A { A<T>(); };9.3.4 [dcl.meaning] paragraph 1 appears to say that it isnot allowed, but it is not clear.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
| 2013-10-14 00:00:00 | admin | set | status: dr -> drwp |
| 2013-05-03 00:00:00 | admin | set | status: ready -> dr |
| 2012-11-03 00:00:00 | admin | set | status: review -> ready |
| 2012-09-24 00:00:00 | admin | set | messages: +msg3888 |
| 2012-02-27 00:00:00 | admin | set | messages: +msg3756 |
| 2012-02-27 00:00:00 | admin | set | status: open -> review |
| 2011-12-24 00:00:00 | admin | create | |