Dale Johannesen <[EMAIL PROTECTED]> wrote: >> I do think the C++ FE needs fixing before Diego's change gets merged, >> though. I can make the change, but not instantly. If someone files >> a PR, and assigns to me, I'll get to it at some not-too-distant >> point. > > It would be good to have a way to mark things as "write once, then > readonly" IMO. > It's very common, and you can do some of the same optimizations on > such things > that you can do on true Readonly objects.
We had this once, it was called RTX_UNCHANGING_P, and it was a big mess. Progressively, we have been removing TREE_READONLY from C++ const variables (which are "write once" from the GCC IL point of view), and this is another instance of the same problem. We probably need a better way to describe C++ constructors, maybe something like WRITEONCE_EXPR which is a MODIFY_EXPR with a READONLY on its lhs, and which is supposed by the frontends when initialing such variables. Giovanni Bajo