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

Clang compile error for file XLStyles.hpp #310

Closed
MoniqueRFC opened this issue Dec 17, 2024 · 14 comments
Closed

Clang compile error for file XLStyles.hpp #310

MoniqueRFC opened this issue Dec 17, 2024 · 14 comments
Assignees
Labels
bug Something isn't working resolved This issue has been resolved.

Comments

@MoniqueRFC
Copy link

When trying to build a project that includes the OpenXLSX library I get below errors which causes ninja to fail:

[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2126:9: error: explicitly defaulted copy constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
[build] 2126 | XLStyles(const XLStyles& other) = default;
[build] | ^
[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2193:45: note: copy constructor of 'XLStyles' is implicitly deleted because field 'm_numberFormats' has a deleted copy constructor
[build] 2193 | std::unique_ptr m_numberFormats; // handle to the underlying number formats
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\memory:3451:5: note: 'unique_ptr' has been explicitly marked deleted here
[build] 3451 | unique_ptr(const unique_ptr&) = delete;
[build] | ^
[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2126:43: note: replace 'default' with 'delete'
[build] 2126 | XLStyles(const XLStyles& other) = default;
[build] | ^~~~~~~
[build] | delete
[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2139:19: error: explicitly defaulted copy assignment operator is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
[build] 2139 | XLStyles& operator=(const XLStyles& other) = default;
[build] | ^
[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2193:45: note: copy assignment operator of 'XLStyles' is implicitly deleted because field 'm_numberFormats' has a deleted copy assignment operator
[build] 2193 | std::unique_ptr m_numberFormats; // handle to the underlying number formats
[build] | ^
[build] C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include\memory:3452:17: note: 'operator=' has been explicitly marked deleted here
[build] 3452 | unique_ptr& operator=(const unique_ptr&) = delete;
[build] | ^
[build] PATH/cpm-cache/openxlsx/d5fef227e58012c750c8837487d06d304d486720/OpenXLSX\headers\XLStyles.hpp:2139:54: note: replace 'default' with 'delete'
[build] 2139 | XLStyles& operator=(const XLStyles& other) = default;
[build] | ^~~~~~~
[build] | delete
[build] 2 errors generated.

@aral-matrix
Copy link
Collaborator

Thanks for flagging this. I'll implement some explicit copy constructor & assignment operators. That should clear the error. Maybe I'll get to it tomorrow.

@aral-matrix aral-matrix self-assigned this Dec 17, 2024
@aral-matrix aral-matrix added the bug Something isn't working label Dec 17, 2024
@aral-matrix
Copy link
Collaborator

As per 02f7d42#diff-6df3199d905212627966d86c63ed0230a5f5e6d5643421752d3fc8f5a35a1099R2116 and following, I hope for this issue to no longer occur - @MoniqueRFC could you verify from the development-aral branch whether this is resolved now?

@aral-matrix aral-matrix added the testing Functionality has been implemented in development branch and is pending a merge into main label Dec 20, 2024
@MoniqueRFC
Copy link
Author

Thanks for taking care of it. I am getting two new errors though, while the original ones disappeared:

[build] In file included from PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\OpenXLSX.hpp:49:
[build] In file included from PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers/XLCell.hpp:65:
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1293:19: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
[build] 1293 | XLBorder& operator=(XLBorder&& other) noexcept = default;
[build] | ^
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1381:47: note: move assignment operator of 'XLBorder' is implicitly deleted because field 'm_nodeOrder' has no move assignment operator
[build] 1381 | const std::vector< std::string_view > m_nodeOrder = { "left", "right", "top", "bottom", "diagonal", "vertical", "horizontal" };
[build] | ^
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1293:58: note: replace 'default' with 'delete'
[build] 1293 | XLBorder& operator=(XLBorder&& other) noexcept = default;
[build] | ^~~~~~~
[build] | delete
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1659:23: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
[build] 1659 | XLCellFormat& operator=(XLCellFormat&& other) noexcept = default;
[build] | ^
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1803:47: note: move assignment operator of 'XLCellFormat' is implicitly deleted because field 'm_nodeOrder' has no move assignment operator
[build] 1803 | const std::vector< std::string_view > m_nodeOrder = { "alignment", "protection" };
[build] | ^
[build] PATH/openxlsx/47bc049774588e82186b6578589f1d5d22f404ba/OpenXLSX\headers\XLStyles.hpp:1659:66: note: replace 'default' with 'delete'
[build] 1659 | XLCellFormat& operator=(XLCellFormat&& other) noexcept = default;
[build] | ^~~~~~~
[build] | delete
[build] 2 errors generated.

@aral-matrix
Copy link
Collaborator

Thanks for checking! I am not very good with move and copy constructors yet, I basically started using them regularly when I started contributing here. I will fix those missing constructors and comment here when I upload a patch.

@aral-matrix
Copy link
Collaborator

Gosh I hate how useless std::array is - I just realized these new errors come from me - by desperation - declaring what could be a static constexpr as a regular const for the insertion order arrays of XML element nodes.
std::array could be used in a constexpr, but it can't be passed to a function without either using a template OR providing both template arguments: the type therein and the amount of elements
:/ I will try to fix that now.

@aral-matrix
Copy link
Collaborator

Okay, have a look at 7a72687 please - I made the offending const std::vector lines into inline static which appears to prevent the default copy-constructors & assignment operators from getting deleted.

@MoniqueRFC
Copy link
Author

Thank you very much for fixing this so fast despite all the obstacles, there are no more compile errors!! :)

@aral-matrix aral-matrix added resolved This issue has been resolved. ready to close Pull request has been answered or implemented & is pending closure and removed resolved This issue has been resolved. labels Dec 23, 2024
@aral-matrix
Copy link
Collaborator

aral-matrix commented Dec 23, 2024

Thank you for helping to improve the library! I'll close your related pull request now with reference to this issue. :)

I will merge the patches from the development branch over to the main branch in a few days.

@aral-matrix
Copy link
Collaborator

@MoniqueRFC - would you be willing to test the newest patch to the development branch with CLang? Since I changed some lower level templated stuff, I would appreciate knowing whether there's anything the compiler will complain about, that I need to fix before merging into the master branch.
Help is appreciated! :)

@aral-matrix aral-matrix added the help wanted Extra attention is needed label Dec 30, 2024
@aral-matrix
Copy link
Collaborator

bump - @MoniqueRFC - would you have a look at the latest version / compatibility with your CLang setup?

@MoniqueRFC
Copy link
Author

MoniqueRFC commented Jan 6, 2025

Sorry, @aral-matrix, I will check it today.
Edit: The latest version compiles fine with clang.

@aral-matrix
Copy link
Collaborator

Thank you very much for testing! No need to apologize :) I will merge the latest branch into master later today then & close all issue that have been fixed / addressed.

@MoniqueRFC
Copy link
Author

No problem, thanks again for the fix :)

@aral-matrix
Copy link
Collaborator

Patch has been merged into master.

@aral-matrix aral-matrix added resolved This issue has been resolved. and removed help wanted Extra attention is needed testing Functionality has been implemented in development branch and is pending a merge into main ready to close Pull request has been answered or implemented & is pending closure labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved This issue has been resolved.
Projects
None yet
Development

No branches or pull requests

2 participants