On 02/03/2016 05:59 PM, Richard Shaw wrote: > In member function 'void OpenImageIO::v1_6::pugi::xml_document::create()': > /builddir/build/BUILD/oiio-Release-1.6.9/src/include/OpenImageIO/pugixml.cpp:5143:58: > error: placement new constructing an object of type > 'OpenImageIO::v1_6::pugi::impl::xml_document_struct' and size '44' in a > region of type 'char [1]' and size '1' [-Werror=placement-new] > _root = new (page->data) impl::xml_document_struct(page);
It's the use of char data[1] as a flexible array member. I'm not sure if this is valid C++. Warning about it is certainly appropriate. You should remove the data member, use sizeof(xml_memory_page) instead of offsetof(xml_memory_page, data), and replace page->data with reinterpret_cast<char *>(page) + sizeof (impl::xml_memory_page), or ideally, have xml_memory_page::construct() return both pointers. You probably should check for wraparound in the size computations as well, to avoid allocating less memory than requested. Florian -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org