243 karma · joined April 26, 2015
Compiler intrinstics havet changed a lot since then, but the wording in the standard remains quite stable in this department
Disclaimer; I did not read your post in full (on set, working atm).
Edit: time flies, it has been more than half a decade.
This post is part of the series regarding non-constant constant-expressions in C++, previous posts are linked below:
I am still waiting for the relevant parties to reply to my emails, but an article explaining "everything" (and the different approaches (about 3 at the current time, in addition to "friendly definitions") will be published soon.
There is a lot of wording that has to be changed in order to prevent the semantics explained.
In other words; if one sees this as a "bug" in the ISO C++ Standard, the "problem" is a lot deeper than friendly definitions (the technique used in the post).
C++ is a complex language, where many rules touch upon other, and with that it is not surprising that some rules can be bent to allow behavior which was perhaps never intended.
Future posts (probably after part 3) will address the philosophy of the "exploit", other techniques that boil down to doing the same thing, as well as proposed (ISO Standard) wording to "fix" the "problem" - if that is the path being walked.
Feedback is more than welcome!
/Filip Roséen
That quote was written in a "this is what most of us used to think" sort of way, it was never intended to be read literally - though maybe I should clearify the intent.
I certainly agree with your post, and your little hack is very cute; +1! :-)