Fix issues with constructors on GCC and Clang - #31
Conversation
Fixes
```
/home/aminya/opennurbs/opennurbs_statics.cpp:747:21: error: uninitialized const ‘ON_AngleValue::Unset’ [-fpermissive]
747 | const ON_AngleValue ON_AngleValue::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ON_AngleValue);
| ^~~~~~~~~~~~~
In file included from /home/aminya/opennurbs/opennurbs.h:81,
from /home/aminya/opennurbs/opennurbs_statics.cpp:1:
/home/aminya/opennurbs/opennurbs_string_value.h:274:16: note: ‘const class ON_AngleValue’ has no user-provided default constructor
274 | class ON_CLASS ON_AngleValue
| ^~~~~~~~~~~~~
/home/aminya/opennurbs/opennurbs_string_value.h:277:3: note: constructor is not user-provided because it is explicitly defaulted in the class body
277 | ON_AngleValue() = default;
| ^~~~~~~~~~~~~
```
|
Is there a specific build that this is causing errors with? |
|
Yes. Building with Clang or GCC causes the error I mentioned above. |
|
Is there a specific platform combination where this was not working? We compile with Xcode on OSX and GCC/Clang on Linux |
|
Maybe the compilers you test with are not the recent versions. I can set up a GitHub Action CI system if you really want to see which combinations are failing to build opennurbs. The ones I tested this with: This ON_CLANG_CONSTRUCTOR_BUG_INIT hack also causes a huge number of warnings on Clang due to the calls to the deleted functions. That's why I added this line in the CMakeLists.txt file |
|
I'm sure this macro was from XCode as the comments in the ON_CLANG_CONSTRUCTOR_BUG_INIT marcro declaration alludes to. We'll need to test to see what the latest version of XCode does now. |
|
I tried fixing this in a different way. It turns out the two classes in question did not have initial values set for all of their members which would cause the compile error on clang. Here's the PR |
Cherry-picked from #28