11 Classes [class]

11.4 Class members [class.mem]

11.4.5 Constructors [class.ctor] General [class.ctor.general]

A constructor is introduced by a declaration whose declarator is a function declarator ([dcl.fct]) of the form where the ptr-declarator consists solely of an id-expression, an optional attribute-specifier-seq, and optional surrounding parentheses, and the id-expression has one of the following forms:
Constructors do not have names.
In a constructor declaration, each decl-specifier in the optional decl-specifier-seq shall be friend, inline, constexpr, or an explicit-specifier.
[Example 1: struct S { S(); // declares the constructor }; S::S() { } // defines the constructor — end example]
A constructor is used to initialize objects of its class type.
Because constructors do not have names, they are never found during name lookup; however an explicit type conversion using the functional notation ([expr.type.conv]) will cause a constructor to be called to initialize an object.
[Note 1:
The syntax looks like an explicit call of the constructor.
— end note]
[Example 2: complex zz = complex(1,2.3); cprint( complex(7.8,1.2) ); — end example]
[Note 2:
For initialization of objects of class type see [class.init].
— end note]
An object created in this way is unnamed.
[Note 3:
[class.temporary] describes the lifetime of temporary objects.
— end note]
[Note 4:
Explicit constructor calls do not yield lvalues, see [basic.lval].
— end note]
[Note 5:
Some language constructs have special semantics when used during construction; see [class.base.init] and [class.cdtor].
— end note]
A constructor can be invoked for a const, volatile or const volatile object.
const and volatile semantics ([dcl.type.cv]) are not applied on an object under construction.
They come into effect when the constructor for the most derived object ([intro.object]) ends.
A return statement in the body of a constructor shall not specify a return value.
The address of a constructor shall not be taken.
A constructor shall not be a coroutine.