-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Labels
bugSomething isn't workingSomething isn't working
Description
If I create an automatic variable with an array of objects that require a destructor call, the elements are incorrect destructed from first to last. They should be destructed in reverse order.
Reproducer:
#include <iostream>
int count = 0;
struct S {
int i;
S() {
i = count++;
std::cout << "S ctor, i = " << i << "\n";
}
~S() {
std::cout << "S dtor, i = " << i << "\n";
}
};
int main() {
S s[10];
return 0;
}
https://godbolt.org/z/3xbbTGM6M
(Note: As of the time I submitted this issue, only one element gets constructed or destructed. Hopefully, the link above will show the problem after #1758 is merged.)
bcardosolopes
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working