This bug makes absolutely no sense because there are seemingly unlimited places where you can comment out or uncomment a section and it goes away. The error given is:
error: definition with same mangled name '_ZN6jeaiiiL6digitsE' as another definition
A minimal example is given here on Godbolt. And here as a repo you can download.
On my computer I am using Clang version 22.0.0, but the Godbolt version is 21.1.0 and the same thing happens.
The source looks something like this:
main.cpp:
#include "./StringClass.h"
#include <exception>
import glm_module; // MOVING THE IMPORT HIGHER BEFORE THE INCLUDE MAKES IT COMPILE
struct Foo {
unsigned int member; // MAKING THIS TYPE INT INSTEAD OF UNSIGNED INT MAKES IT COMPILE
};
void selectPhysicalDevice()
{
//std::terminate(); // UNCOMMENTING THIS MAKES IT COMPILE
Foo foo{};
auto max_samplers = foo.member;
String str;
str.append(max_samplers); // COMMENTING THIS OUT MAKES IT COMPILE
// REPLACING max_samplers WITH AN INTEGER LITERAL, ie., 1, MAKES IT COMPILE
String str2;
str2.append(1); // COMMENTING THIS OUT MAKES IT COMPILE
}
int main()
{
}
As you can see it makes absolutely no sense. I tried to compile this on a new version of MSVC and it compiles fine. It's interesting the error goes away when doing import BEFORE the includes on Clang, because I was told on GCC it's the other way around, the imports need to come AFTER the includes.
1isint), that goes down to 78 lines,making it easier to see what is relevant. ("Basic" meaning I did not attempt to debug, just simplify.)