Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix for duplicate symbols #81

Open
wants to merge 3 commits into
base: 1.2.0rc
Choose a base branch
from

Conversation

pmocz
Copy link

@pmocz pmocz commented Jan 8, 2025

Fixes issue: #80

The issue is that:

According to the cpp standard, an explicit instantiation is only allowed to appear once in the entire program.

https://en.cppreference.com/w/cpp/language/class_template

Some gcc compilers will fail if this is not the case.

The challenge is that the member functions of the templated classes have been defined in multiple files (engine_run.cpp, engine_printer.cpp, engine_init.cpp, engine_step_report.cpp). The solution is to only explicitly instantiate the class in engine_init.cpp and then only instantiate rest of the functions in the other files.

See:

https://stackoverflow.com/questions/21534435/separate-compilation-and-template-explicit-instantiation

@haykh
Copy link
Collaborator

haykh commented Jan 13, 2025

@pmocz thanks Philip! kinda weird that with clang19 this warning doesn't show up :\ also, yes, this is one of the reasons i hate c++ so much. in any other language you wouldn't even have to instantiate it at all. the compiler should be able to deduce that from places where the class is used. will merge it to the new release candidate instead of master.

@haykh haykh changed the base branch from master to 1.2.0rc January 13, 2025 19:13
@haykh haykh added the warning label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants