lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Building lmi using C++20 compiler


From: Vadim Zeitlin
Subject: [lmi] Building lmi using C++20 compiler
Date: Fri, 27 Nov 2020 23:55:04 +0100

 Hello,

 There are some changes in std::filesystem library in the newest versions
of gcc, so I wanted to check lmi with them and, as a side effect of this,
also build it in C++20 mode because sooner or later we're going to switch
to it, so it doesn't seem completely wasteful to start looking at it now.

 Globally, the news is mostly good, and there are just a couple of
problems. First one is that test_same() calls in bourn_cast_test.cpp
involving char16_t, char32_t and wchar_t don't compile because of
INVOKE_BOOST_TEST_EQUAL() using values of these types and ending up trying
to compile the code which inserts these values into std::ostream. In C++20,
overloads of operator<<() taking these types in basic_ostream<char>
specializations are explicitly deleted, as inserting UTF-{16,32} strings in
char streams never worked, and now this is detected during compile-, rather
than run-, time. This is a useful change, but it does break compilation in
this case. Of course, fixing it wouldn't be very difficult: we'd just need
to use an extra level of indirection, i.e. some function that would do
nothing by default, but convert char{16,32}_t and wchar_t to a string, e.g.
by using hex escapes for all non-ASCII characters, that could be inserted
into a stream. However omitting the tests for these types from
bourn_cast_test.cpp would be even simpler and, IMO, not any less useful
because we're never going to use bourn_cast<> with them anyhow -- and
perhaps we should even fail to compile its use with it (which would be
pretty trivial as we'd just delete these overloads too, just as it's done
for std::ostream). OTOH if you do want to keep the tests for these types,
we probably need to add a test for char8_t too because there doesn't seem
to be any reason to exclude that one.

 To summarize, please let me know if you absolutely want to keep the (not
very useful in practice, IMHO) tests for the types above and, if you do,
whether you have any preferences for the helper "to_stream" function we'd
need to add.


 Second problem concerns Boost.Numeric compilation: it doesn't compile any
longer because it uses std::allocator<>::construct() removed in C++20. This
can be fixed by just adding more changes to boost_1_33_1.patch, but I
wonder if we really want to keep updating this prehistoric Boost version.
I'd seriously consider either upgrading to new Boost (that I'd like to also
use as a submodule rather than downloading it from somewhere) or just
removing its use from expression_template_0_test.cpp which is the only
place using it. But, again, please let me know if you'd prefer to just add
the required change to the patch for now.

 Thanks in advance,
VZ

Attachment: pgpio1BDOJD0w.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]