Trying out Swift C++ interopt with Qt, I’m getting a warning for this piece of code in Qt:
[[nodiscard]] constexpr auto QChar::fromUcs4(char32_t c) noexcept
{
struct R {
char16_t chars[2];
[[nodiscard]] constexpr operator QStringView() const noexcept { return {begin(), end()}; }
[[nodiscard]] constexpr qsizetype size() const noexcept { return chars[1] ? 2 : 1; }
[[nodiscard]] constexpr const char16_t *begin() const noexcept { return chars; }
[[nodiscard]] constexpr const char16_t *end() const noexcept { return begin() + size(); }
};
return requiresSurrogates(c) ? R{{QChar::highSurrogate(c),
QChar::lowSurrogate(c)}} :
R{{char16_t(c), u'\0'}} ;
}
/Users/torarne/build/qt/6.x-prefix/install/lib/QtCore.framework/Headers/qstringview.h:482:12: warning: cycle detected while resolving 'fromUcs4' in swift_name attribute for 'R' [#ClangDeclarationImport]
480 | [[nodiscard]] constexpr auto QChar::fromUcs4(char32_t c) noexcept
481 | {
482 | struct R {
| |- warning: cycle detected while resolving 'fromUcs4' in swift_name attribute for 'R' [#ClangDeclarationImport]
| `- note: please report this issue to the owners of 'QtCore'
483 | char16_t chars[2];
484 | [[nodiscard]] constexpr operator QStringView() const noexcept { return {begin(), end()}; }
Is is a bug or missing feature that the C++ interopt can deal with this construct? Is there an easy way to tweak things on the Qt side here to fix it?
Thanks!