I was working on something, got lost in “template error land” (as often happens in C++), so backed together a small snippet to test out a small part of the change.
(Don't read too much into it, the snippet is pretty meaningless and only exists to prove this is a true story)
Then I copy-pasted bits of this back into my code, and it gave an “invalid constexpr” error and I said “d’oh, I just have to reword this constexpr as a single return statement for this older compiler.”
So I fixed it and everything was good, but then I realized with a sigh (again, as often happens in C++) that this is part of the “teaching cpp is hard” problem.
It isn't just like Python 2 and Python 3, where you learn maybe two versions of some things; instead, there are multiple versions of multiple things. In this case you have to somehow know that constexpr had restrictions that were relaxed in later versions of the compiler, but it's not clear how to know this.
In my case, I'm old 😄 ... I just happen to have seen all the versions come and go, so I remember most of the details, but if someone wanted to learn C++ from scratch, what's the better way now?
Earlier you could at least say “read all the Scott Meyers books”, but is there a compressed version of all that these days?