rjmccall added a comment.

If you're going to try to enforce the declared type of memory, you'll also need 
something like the C effective type rule to handle char buffers in C++.  As far 
as I can tell, it's not actually legal under the spec to cast an array of chars 
to an arbitrary type and access it that way — you have to do something to 
establish that there's an object of that type there first.  If you memcpy'ed 
into that buffer from an object of the right type, that would be sufficient to 
create a new formal object of that type, but I don't see any way to sensibly 
apply that rule to e.g. the POSIX "read" function.  It seems to me that you at 
least need to have a rule saying that it's okay to access a formal object of 
type char/char[] using an arbitrarily-typed l-value.


https://reviews.llvm.org/D32199



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

Reply via email to