According to the C++23 standard, what is the output of this program?
#include <iostream>
struct X {
int var1 : 3;
int var2;
};
int main() {
X x;
std::cout << (&x.var1 < &x.var2);
}How would the type of a pointer to a bit-field look like?
The program has a compilation error
int var1 : 3; declares a bit-field, and you can not apply operator& to a bit-field. §[class.bit]¶3 in the standard:
The address-of operator
&shall not be applied to a bit-field, so there are no pointers to bit-fields.