A
a.s.matveyev
Say, for example, that I've got an object with static storage duration, andthe constructor of this object (declared as constexpr) sets one of the members to this. Will such an object be initialised statically? I can't find any clear answer to this question in the standard. On the one hand, using 'this' doesn't work very well with constant expressions, as you can see in 5.19, but on the other hand taking the address of an object with static storage duration produces a valid constant expression (5.19 again) and I can't see why 'this' should be different. I've made a simple example (http://ideone.com/IIe0Ay) to try and see what different compilers think about this matter, and it turned out that even compilers disagree with each other here. The binary produced by clang works nice and well (static initialisation, I guess), while the one produced by gcc segfaults immediately (trying to initialise root dynamically). Basically, my question is what the standard really says on the matter and why?