Title
Identifying constructors
Status
tc1
Section
11.4.5 [class.ctor]
Submitter
Jamie Schmeiser

Created on 2000-01-11.00:00:00 last changed 254 months ago

Messages

Date: 2000-04-15.00:00:00

Proposed resolution (10/00):

  1. Add to 11.4 [class.mem] paragraph 13

    • every member function of class T [Note: this restriction does not apply to constructors, which do not have names (11.4.5 [class.ctor]). ];

    immediately following the line

    • every data member of class T;
  2. Change 11.4.5 [class.ctor] paragraph 1 from

    A special declarator syntax using an optional function-specifier (9.2.3 [dcl.fct.spec])...

    to

    A special declarator syntax using an optional sequence of function-specifiers (9.2.3 [dcl.fct.spec])...
Date: 2004-09-10.00:00:00

According to 11.4.5 [class.ctor] paragraph 1, the syntax used in declaring a constructor allows at most one function-specifier. It is thus not permitted to declare a constructor both inline and explicit. This seems overly restrictive.

On a related note, there doesn't seem to be any explicit prohibition against member functions with the same name as the class. (Such a prohibition might reasonably be expected to occur in 11.4 [class.mem] paragraph 13, but member functions are not listed there.)

One possible interpretation would be that such member functions would violate the restrictions in 6.4.7 [basic.scope.class] paragraph 1, because the class name would refer to the class at some points in the class scope and to the member function at others. However, this seems a bit tenuous. Is an explicit prohibition needed?

(See also issue 147.)

History
Date User Action Args
2003-04-25 00:00:00adminsetstatus: dr -> tc1
2000-11-18 00:00:00adminsetstatus: ready -> dr
2000-05-21 00:00:00adminsetmessages: + msg314
2000-05-21 00:00:00adminsetstatus: open -> ready
2000-01-11 00:00:00admincreate