Then how do you plan arguing what is correct and what is not in C++ when do you can't even read SIMPLIFIED C++ documentation?
Look at how other languages deal with it and what your gut instinct tells you.
This " (since C++11)" is referring ONLY to one word "unscoped", noting else.
mix of c++ languages", no, this is state for C++20 but simply note where given change was introduce to language or remove from it.
... ?
And you fail to see point why `--` and `++` is removed, reason is simple as result is pointless as `++b` result will always be `true` and in `--b` will invert state.
You a hypocrit. -- and ++ is not ok/banned/removed/can't even test it. While you fine with - and + which does mathetically more or less the same. In Delphi it is not allowed without a typecast. Plus results can be different depending on boolean or bytebool. Where bytebool is negative for false. So this code would then not work for bytebool.
Basically the code depends on how a language translates false into a numerical value, this can vary from language to language. When writing code it's important to keep in mind how other languages might deal with this.
In case of `-` and `+` there is no problems like this, as standard clearly state this is converted to `int` with values `0` and `1` and then apply this operators.
Which is weird to auto convert a boolean to some other arbitrary type. Why not convert it to a string and use - and + as string operators ?
If you try do `b = -b;` then yes this have no sense and compiler should warning about this, but in case of my code this is no the case as I effective do `int i = -b;` that have clear and understandable meaning.
This is not clear from code, the conversion from boolean to integer is implicit and highly confusing and completely depends on what the language does, languages do different things in this case.
If you do not see difference between this two cases I do not see point discussion this any further.
There are even more cases as you indicated, and you yourself state that it doesn't make sense. My Delphi programming experience has shown me that converting booleans to anything else is very tricky and can cause problems and you yourself indicate there are problems in c/c++ where it does weird things like b = -b;
Also consider how easy it is to overlook it and think of it as negation which apperently it's not really: -boolean(0) stay at 0.
btw No other compiler show errors in this case (GCC, Clang and ICC), and IMHO VS is incorrect in that case and it should be fixed as this is false positive warning.
https://godbolt.org/z/ad3PG48Mq
Even if I add aggressive warnings in other compilers they do not show no warning
Perhaps Microsoft knows something we don't, that it might be removed in the future or there is some weird bug potential.
Anyway it does warn for another potential pitfall which I don't see how it can be triggered, the + between both booleans can overflow, the booleans are converted to 8 bit values.
So here the language seems inconsistent, is it converted to int32 or int8 ? strange stuff.
For now I agree with you the code is "relatively" safe in C/C++ since it follows this weird standard, but it ain't pretty and it's an annoying warning messages, getting rid of it would be nice.
You all spent so much time getting rid of warning messages, didn't see a single one, this is the only one ! =D