[GiNaC-list] Usage of designated initializer in factor.cpp forces c++20 on GiNaC

Richard B. Kreckel kreckel at in.terlu.de
Sat Oct 28 17:57:29 CEST 2023


Hi Igor,

Thank you for pointing out this little transgression of the language 
standard version.

On 10/1/23 00:57, Igor Machado wrote:
> In the end, I managed to find and fix the error, so I wanted you to know 
> that the file factor.cpp from GiNaC is using designated initializers, 
> which is only part of c++20... and when I activated c++20 here, the 
> linking was broken on windows! So, a solution was to change (around line 
> 2344):
> factorization_ctx ctx = {.poly = poly, .x = x, .syms_wox = syms_wox};
> And transform into this:
> factorization_ctx ctx{poly, x, syms_wox};
> 
> After that, I can enable c++17 and it works on GCC, Clang and MSVC! For 
> GCC and Clang, they don't complain on designated initializers, even if 
> it's c++17 standard...

It is not worth pulling in C++20 for this. We'll change it to a 
brace-closed initializer list as you suggest.

All my best,
   -richy.
-- 
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>



More information about the GiNaC-list mailing list