Greetings all, Here's a strange crash I'm getting using Visual C++ 2013. I compiled myself Qt 5.2.1 (64bits), "designer" and others work fine, as well as all the examples and other programs I've tried.
Please consider this code: --8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--- class S { public: S(QString const& name_): l_name(name_) { } QString const& name() const { return this->l_name; } private: QString l_name; }; // S int main(int argc, char* argv[]) { std::vector<S> vs { {"patam"}, {"fo_"}, {"kik_1"}, {"kik_n"}, {"kliton"}, {"wu-harr"} }; for(S const& l: vs) { qDebug() << l.name(); } return 0; } --8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--- Sometimes this code crashes, sometimes it doesn't, in every cases it prints garbage. If I replace "QString" by "std::string", it works fine. If I store directly "QString"s in the vector, it works fine. If I fill the vector like this: --8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--- S ts[] = { {"patam"}, {"fo_"}, {"kik_1"}, {"kik_n"}, {"kliton"}, {"wu-harr"} }; std::vector<S> vs; for(S const& l: ts) { vs.emplace_back(l.name()); } --8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<--- ...then it works fine. When trying GCC, either on Linux or using MinGW, it works fine. Any hint about what may happen? is it a compiler bug, or something else? Any idea about a workaround? Thanks in advance for any idea :-) -- /- Yves Bailly - Software developer -\ \- Sescoi R&D - http://www.sescoi.fr -/ "The possible is done. The impossible is being done. For miracles, thanks to allow a little delay." _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest