rsmith added a comment.

In https://reviews.llvm.org/D35216#856415, @NoQ wrote:
> We already have the object's fields in the AST, with its AST record layout, 
> however field names and layouts are implementation-dependent, and it is 
> unsafe to try to understand how the specific standard library 
> implementation's layout works and what specific private fields we see in the 
> AST mean.


This is precisely how the rest of the compiler handles 
`CXXStdInitializerListExpr`, is how it's intended to be used, and is really the 
only way it can work if you want to evaluate the members of 
`initializer_list<T>` rather than hardcoding their meaning. Consumers of 
`CXXStdInitializerListExpr` are expected to handle two cases: 1) the class has 
no base classes and two fields of type `const T*` and `size_t` (begin and 
size), and 2) the class has no base classes and two fields, both of type `const 
T*` (begin and end). (Unfortunately, we reject all other cases during CodeGen 
rather than in Sema, so you may still see them for now.)


https://reviews.llvm.org/D35216



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to