Closed newincpp closed 7 months ago
Its a expected-lite
module https://github.com/martinmoene/expected-lite, and there seems C++23 fix is included to there.
So updating expected-lite header file in TinyUSDZ would solve the issue .
Updated expected-lite in this commit: https://github.com/syoyo/tinyusdz/commit/ac42ddeb186945a0b2ce3e936be9ae52f2b391d4
I thinks this should fix the build on C++20/23 compiler
Oh woah you were fast. I'm sorry, I thought it was a code from tinyusdz and not an imported module. Updating it with your last commit indeed fixed the issue, thanks!
Hi, I was trying to integrate tinyusdz in my (non-cmake) C++20 project and I was hitting this error:
You can reproduce the error by setting
CMAKE_CXX_STANDARD
to 20 inCMakeLists.txt
According to cppref: https://en.cppreference.com/w/cpp/utility/expectedstd::expected
is a C++23 feature not a C++20 so enabling it when using C++20 is triggering an error.The fix with the current code architecture would be relatively easy:
With this tiny modification the code compile fine if C++20 is enabled.
Optionally for C++20 and onward features I would advice using the feature testing macro instead of the the cplusplus version. According to the same documentation page the macro emitted by the compiler you should test is: `cpp_lib_expected` more about C++20 feature testing: https://en.cppreference.com/w/cpp/feature_test This would require a bit more work on this file. Which is why I'm not making a pull request.