Hi, Thiago Macieira <thiago.macie...@intel.com> schrieb am Fr. 17. Juli 2020 um 19:57:
> On Wednesday, 15 July 2020 13:20:33 PDT Thiago Macieira wrote: > > In addition, I'd like someone to explain here: > [snip] > > 5) How you're going to fix the UB in the code generated by moc. This > requires > a satisfactory answer of C++17 or C++2a strictly compliant code, or we'll > have > to stop using this feature. > > moc generates: > > Type Klass::_qt_property_api_propertyName::value() const > { > const size_t propertyMemberOffset = > reinterpret_cast<size_t>(&(static_cast<Klass > *>(nullptr)->propertyName)); > const auto *thisPtr = reinterpret_cast<const Klass *>( > reinterpret_cast<const char *>(this) - propertyMemberOffset); > return thisPtr->d_func()->property.value(); > } > > The first two lines of this function are UB. > > It MUST be fixed. > This hack has been in QtQml in production since its release in 2010 (see static cast selector). It would be a shame if this stopped working :-/ Simon >
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development