C++20 deprecated some certain operations on volatile types (following P1152).
The following code, that was valid prior to C++20:
void busyLoop(std::size_t count) {
for (volatile size_t counter = 0; counter < count; ++counter);
}
now generates a deprecation warning:
warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
Changing the ++ to += or to counter = counter + 1 doesn't help, as the problem seems to be with calculating a new value based on a volatile type.
How can the above code be adjusted to the new C++20 rules?