On Thursday 12 November 2015 23:05:37 Igor Mironchik wrote: > Hi folks, > > Is it a bug or feature?
First of all, allocating memory when throwing exceptions is bad practice. Avoid it by redesigning your code. > TextFileViewException::TextFileViewException( const QString & what ) > : std::runtime_error( what.toLocal8Bit() ) > , m_what( what ) > { > } > Look at this line: > > std::runtime_error( what.toLocal8Bit() ) > > std::runtime_error() constructs from QByteArray... How it is possible? Because toLocal8Bit() returns a QByteArray and QByteArray has an operator const char*(). Why would it not be possible? Do note that it compiles, but it's probably incorrect because std::runtime_error will probably be carrying a dangling pointer. Like I said, you should redesign so you don't allocate memory when throwing exceptions. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest