------- Comment #26 from mark at codesourcery dot com 2007-01-01 00:41 ------- Subject: Re: [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should
dberlin at gcc dot gnu dot org wrote: > If we add a placement_new_expr, and not try to revisit our interpretation of > the standard, we can just DTRT and fix placement new. This would be best for > optimizations, and IMHO, for users. I agree that treating placement new specially makes sense. The first argument to a placement new operator could be considered to have an unspecified dynamic type on entrance to the operator, while the return value has the dynamic type specified by the operator. (So that the pointer returned by "new (x) int" has type "int *".) I'm not sure that placement_new_expr is the best way to accomplish this, but, maybe it is. Another possibility would be to define an attribute or attributes to specify the dynamic type of arguments and return types, and then have the C++ front end annotate all placement new operators with those attributes. I don't think that the other approach you sketch is very attractive because it sounds like we're going to lose a lot of our TBAA opportunities. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286