Created on 2011-09-23.00:00:00 last changed 95 months ago
[Moved to DR at the November, 2014 meeting.]
Proposed resolution (February, 2014):
Change 11.4 [class.mem] paragraph 4 as follows:
A brace-or-equal-initializer shall appear only in the declaration of a data member. (For static data members, see 11.4.9.3 [class.static.data]; for non-static data members, see 11.9.3 [class.base.init]). A brace-or-equal-initializer for a non-static data member shall not directly or indirectly cause the implicit definition of a defaulted default constructor for the enclosing class or the exception-specification of that constructor.
Notes from the September, 2013 meeting:
One approach that might be considered would be to parse deferred portions lazily, on demand, and then issue an error if this results in a cycle.
Additional note (March, 2013):
A specific example:
struct A { void *p = A{}; operator void*() const { return nullptr; } };
Perhaps the best way of addressing this would be to make it ill-formed for a non-static data member initializer to use a defaulted constructor of its class.
See also issue 1360.
In Bloomington there was general agreement that given a class that uses non-static data member initializers, the exception-specification for the default constructor depends on whether those initializers are noexcept. However, according to 11.4 [class.mem] paragraph 2, the class is regarded as complete within the brace-or-equal-initializers for non-static data members.
This suggests that we need to finish processing the class before parsing the NSDMI, but our direction on issue 1351 suggests that we need to parse the NSDMI in order to finish processing the class. Can't have both...
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
2015-04-13 00:00:00 | admin | set | messages: + msg5390 |
2014-11-24 00:00:00 | admin | set | status: ready -> dr |
2014-05-27 00:00:00 | admin | set | status: drafting -> ready |
2014-03-03 00:00:00 | admin | set | messages: + msg4888 |
2013-10-14 00:00:00 | admin | set | messages: + msg4627 |
2013-10-14 00:00:00 | admin | set | status: open -> drafting |
2013-03-18 00:00:00 | admin | set | messages: + msg4286 |
2011-09-23 00:00:00 | admin | create |