Tam S. B.
2017-02-09 17:13:22 UTC
[dcl.init.aggr]p8 says:
If there are fewer initializer-clauses in the list than there are elements in the aggregate, then each element
not explicitly initialized shall be initialized from its default member initializer (9.2) or, if there is no default
member initializer, from an empty initializer list (8.6.4).
But p11 says:
If an incomplete or empty initializer-list leaves a member of reference type uninitialized, the program is
ill-formed.
According to p8, aggregate members are always initialized (from the initializer-clause, from the default member initializer, or from an empty initializer list). However, p11 seems to imply that a member of reference type may be left uninitialized. How can this be? When does p11 apply?
All compilers I test seem to agree that if a reference member is neither initialized from the initializer-clause, nor initialized from the default member initializer, then it is uninitialized, despite the standard saying that the member shall be initialized from an empty initializer list in this case.
Also, does [dcl.init.aggr]p8 contradicts with [dcl.init]p12 "If no initializer is specifed for an object, the object is default-initialized. "?
If there are fewer initializer-clauses in the list than there are elements in the aggregate, then each element
not explicitly initialized shall be initialized from its default member initializer (9.2) or, if there is no default
member initializer, from an empty initializer list (8.6.4).
But p11 says:
If an incomplete or empty initializer-list leaves a member of reference type uninitialized, the program is
ill-formed.
According to p8, aggregate members are always initialized (from the initializer-clause, from the default member initializer, or from an empty initializer list). However, p11 seems to imply that a member of reference type may be left uninitialized. How can this be? When does p11 apply?
All compilers I test seem to agree that if a reference member is neither initialized from the initializer-clause, nor initialized from the default member initializer, then it is uninitialized, despite the standard saying that the member shall be initialized from an empty initializer list in this case.
Also, does [dcl.init.aggr]p8 contradicts with [dcl.init]p12 "If no initializer is specifed for an object, the object is default-initialized. "?
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+***@isocpp.org.
To post to this group, send email to std-***@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.