D
Davlet Panech
Is this well-formed?
#include <string>
#include <iostream>
std::string &foo() {
static std::string s("abc");
return s;
}
struct bar {
~bar() {
std::cout << foo() << std::endl;
}
};
bar b1;
bar b2;
int main() {
return 0;
}
In gcc the static local gets destroyed before the second global (b2), is
this behavior correct?
Thanks,
D.
#include <string>
#include <iostream>
std::string &foo() {
static std::string s("abc");
return s;
}
struct bar {
~bar() {
std::cout << foo() << std::endl;
}
};
bar b1;
bar b2;
int main() {
return 0;
}
In gcc the static local gets destroyed before the second global (b2), is
this behavior correct?
Thanks,
D.