Consider the following code in which we initialize part of D
based on another part of D
:
struct c {
c() : D{rand(), D[0]} {}
int D[2];
};
int main() {
c C;
assert(C.D[0] == C.D[1]);
}
Is the above program well-defined? Can we safely use one part of the same array to initialize another part of it?
Aucun commentaire:
Enregistrer un commentaire