Dear Florian, Thanks for debugging into this problem! On 2/5/26 10:05 AM, Florian Lorkowski wrote:
I noticed a strange bug, which only happens with some compiler versions. In some cases, nested lists collapse into a flat list. Consider the following program:
#include <iostream> #include "ginac/ginac.h"
using namespace GiNaC; int main(int argc, const char** argv) { std::cout << lst{lst{1}} << std::endl; return 0; }
I tested this with GCC 11.4.0 and clang 21.1.0. With those compilers, it correctly prints
{{1}}
But with clang 19.1.7, it instead yields
{1}
I tested some other cases and it seems that the issue occurs whenever a list has a single element which is also a list.
Of course, it is possible that there is a bug in Clang. We should just try to make sure we haven't triggered some undefined behavior in GiNaC. Testing different compiler versions on godbolt.org on the example discussed here at <https://www.reddit.com/r/cpp/comments/gbntov/bug_in_clang_msvc_regarding_initializer_list/> the problem may be fixed in Clang 20. I can't try out full GiNaC on that compiler. Can you? If there is no easy workaround in GiNaC, then we should require a minimum Clang version which works. To be discussed... All my best, -richy. -- Richard B. Kreckel <https://in.terlu.de/~kreckel/>