[sword-devel] Confused code in a swbuftest.cpp causing a build failure in Fedora

Aaron Rainbolt arraybolt3 at gmail.com
Sat Jan 31 19:10:29 EST 2026


I also had to patch out a couple of spots that wrote UParseError
preContext and postContext contents to 'cout', in
tests/tlitmgrtest.cpp, for similar reasons (you can't write UTF-16
text to 'cout').

--
Aaron

On Sat, Jan 31, 2026 at 5:43 PM Aaron Rainbolt <arraybolt3 at gmail.com> wrote:
>
> Some time ago I got a notification about SWORD failing to build in the
> latest version of Fedora. The error printed by the compiler is:
>
> /builddir/build/BUILD/sword-1.9.0-build/sword-1.9.0/tests/swbuftest.cpp:
> In function 'int main(int, char**)':
> /builddir/build/BUILD/sword-1.9.0-build/sword-1.9.0/tests/swbuftest.cpp:167:41:
> error: use of deleted function 'std::basic_ostream<char, _Traits>&
> std::operator<<(basic_ostream<char, _Traits>&, const wchar_t*) [with
> _Traits = char_traits<char>]'
>   167|        cout << (wchar_t *)x.getRawData() << "\n";
>        |
>
> It then goes on to tell me that the operator is explicitly specified
> as deleted in /usr/include/c++/16/bits/ostream.h. After some quick
> Googling, it looks like the problem is that it's not actually possible
> to '<<' a 'wchar_t *' to 'cout'. You can use 'wcout' for that, but you
> can't mix those in the same program.
>
> The code itself seems to be intended to make sure that a test UTF-8
> string containing Russian characters renders correctly after going
> through a conversion to UTF-32 (on Linux, or UTF-16 on Windows), and
> then back to UTF-8. But since you can't actually print the UTF-{16,32}
> version on the console in this program without converting it to UTF-8,
> I don't really see the point. Why not print the UTF-8 version, then
> convert to UTF-whatever and back to UTF-8, then print that again and
> see what happens?
>
> Am I misunderstanding the code here, or does the above idea sound like
> a good way of fixing this?
>
> For now I'll just patch the test out of Fedora so the package can build again.
>
> --
> Aaron


More information about the sword-devel mailing list