Closed hsdk123 closed 4 months ago
I'm getting the same error. Even a simple test program that just includes sol/sol.hpp
fails with the same error on Clang 19 (current main
) but compiles fine with version 18.1.6.
It boils down to the implementation of the emplace
member function in class optional
.
https://github.com/ThePhD/sol2/blob/e8e122e9ce46f4f1c0b04003d8b703fe1b89755a/include/sol/optional_implementation.hpp#L2189
At first glance it's strange why this ever worked. The construct
member function is not part of optional
.
Some further tests show that clang < 19 doesn't actually test for the existence of the member functions being called inside another member function of a templated type. Clang 19 changed that. This example might be instructive:
template<int i>
struct bar {
void baz() {
this->foo();
}
};
int main(int argc, char**argv){
bar<1> a;
// uncommenting the code below makes it fail on every compiler
// On clang >= 19 it even fails without the explicit call to baz but it works on g++ and clang < 19.
//a.baz();
return 0;
}
So I think this just worked before because emplace
wasn't actually used. For my application I could get everything to work by just removing emplace
entirely.
As a side note: The return type of emplace
is T&
but we don't actually return anything. This should probably be fixed as well.
It seems that this->
doesn't resolve to m_value
as it's suggested by operator overloading.
Thanks @tukss! Hope the fix gets into main
1606 merged - confirming issue resolved! Closing
Hi, I'm seeing a new error in compilation:
compiler:
CMAKE_C_COMPILER: D:/a/Light.vn-core/Light.vn-core/emsdk/upstream/emscripten/emcc.bat