This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
1533. Function pack expansion for member initializationSection: 13.7.4 [temp.variadic] Status: CD3 Submitter: Jonathan Caves Date: 2012-08-06[Moved to DR at the April, 2013 meeting.]
The list of pack expansion contexts in 13.7.4 [temp.variadic] paragraph 4 includes a mem-initializer-list, with no restriction on whether the mem-initializer corresponds to a base class or a member. However, it appears from 11.9.3 [class.base.init] paragraph 15 that such a pack expansion is intended for bases:
A mem-initializer followed by an ellipsis is a pack expansion (13.7.4 [temp.variadic]) that initializes the base classes specified by a pack expansion in the base-specifier-list for the class.
This is not conclusive, however, and use of a pack expansion with a mem-initializer for a member could be used with packs containing zero or one element:
class S { }; template<typename... T> class X { public: X(T ...args) : data_(args)... { } private: S data_; }; int main() { S s; X<> x1; X<S> x2(s); }
The Standard should be clarified as to whether such a usage is permitted or not.
Proposed resolution (October, 2012):
Change 13.7.4 [temp.variadic] paragraph 4 as follows:
...Pack expansions can occur in the following contexts:
...
In a mem-initializer-list (11.9.3 [class.base.init]) for a mem-initializer whose mem-initializer-id denotes a base class; the pattern is a themem-initializer.
...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4