You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DefaultConstructible requires T x(), T x{}, T() and T{} be valid statements but says nothing about T x = {} , a.k.a. copy-list-initialization. This is the semantic used to initialize a function parameter from an empty list argument.
Copy-list-initialization will not call an explicit constructor (13.3.1.7 [over.match.list]), which is not otherwise required by DefaultConstructible. The standard containers have such explicit default constructors (specifically, would-be conversion constructors with default argument).
Therefore, this is invalid:
void f( std::vector< int > ) {}
f( {} );
As far as I've seen, only GCC 4.9 rejects this; Clang and GCC up to 4.8 accept it.
The specific problem with containers as illustrated may be considered a separate defect.
The text was updated successfully, but these errors were encountered:
DefaultConstructible requires T x(), T x{}, T() and T{} be valid statements but says nothing about T x = {} , a.k.a. copy-list-initialization. This is the semantic used to initialize a function parameter from an empty list argument.
Copy-list-initialization will not call an explicit constructor (13.3.1.7 [over.match.list]), which is not otherwise required by DefaultConstructible. The standard containers have such explicit default constructors (specifically, would-be conversion constructors with default argument).
Therefore, this is invalid:
void f( std::vector< int > ) {}
f( {} );
As far as I've seen, only GCC 4.9 rejects this; Clang and GCC up to 4.8 accept it.
The specific problem with containers as illustrated may be considered a separate defect.
Reply to this email directly or view it on GitHub: #236
There's a library issue opened by Richard to make the container default constructors non-explicit, and I'm going to fix gcc 4.9 so the constructors are not explicit. They never should have been explicit and gcc should not have changed them.
DefaultConstructible requires T x(), T x{}, T() and T{} be valid statements but says nothing about T x = {} , a.k.a. copy-list-initialization. This is the semantic used to initialize a function parameter from an empty list argument.
Copy-list-initialization will not call an explicit constructor (13.3.1.7 [over.match.list]), which is not otherwise required by DefaultConstructible. The standard containers have such explicit default constructors (specifically, would-be conversion constructors with default argument).
Therefore, this is invalid:
void f( std::vector< int > ) {}
f( {} );
As far as I've seen, only GCC 4.9 rejects this; Clang and GCC up to 4.8 accept it.
The specific problem with containers as illustrated may be considered a separate defect.
The text was updated successfully, but these errors were encountered: