[PATCH] D16552: Let clang not error out on `const std::vector<int> empty_vec; ` with libstdc++5.3.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 12:28:10 PST 2016


rsmith added a comment.

In http://reviews.llvm.org/D16552#346678, @thakis wrote:

> Will do, thanks! In "If the implicit default constructor initializes all subobjects, no initializer should be required", is "initializes all subobjects meant recursively?


I think so, or more specifically, the implicit initialization would need to be valid if each member were itself `const`.

>   struct Inner {

>     Inner() = default;

>     int i;  // not initialized, but Inner has a default ctor

>   };

>   

>   struct S {

>     Inner inner;

>   };

>   

>   const S s;

> 


This would be ill-formed because `S::S()` would notionally default-initialize `s.inner` of type `const Inner`, which would notionally default-initialize `s.inner.i` of type `const int`, which would be ill-formed.


http://reviews.llvm.org/D16552





More information about the cfe-commits mailing list