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

fix clang (macOS) compile error: object expression of non-scalar type cannot be used in a pseudo-destructor expression #28

Closed
wants to merge 1 commit into from

Conversation

kozyilmaz
Copy link
Contributor

clang on macOS spits out the following error during compilation. This PR wraps ed25519_scalar_t type with a struct

In file included from eddsa_offline_test.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/iostream:43:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ios:222:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:23:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator.h:172:12: error: object expression of non-scalar type 'unsigned char[32]' cannot be used in a pseudo-destructor expression
        __p->~_Tp();
        ~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/allocator_traits.h:315:13: note: in instantiation of member function 'std::allocator<unsigned char[32]>::destroy' requested here
        __a.destroy(__p);
            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:944:25: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<unsigned char[32]>>::destroy<unsigned char[32], void>' requested here
        __alloc_traits::destroy(__alloc(), std::__to_address(--__soon_to_be_end));
                        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:938:29: note: in instantiation of member function 'std::vector<unsigned char[32]>::__base_destruct_at_end' requested here
  void __clear() _NOEXCEPT {__base_destruct_at_end(this->__begin_);}
                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:489:20: note: in instantiation of member function 'std::vector<unsigned char[32]>::__clear' requested here
            __vec_.__clear();
                   ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/exception_guard.h:86:7: note: in instantiation of member function 'std::vector<unsigned char[32]>::__destroy_vector::operator()' requested here
      __rollback_();
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/exception_guard.h:137:10: note: in instantiation of member function 'std::__exception_guard_exceptions<std::vector<unsigned char[32]>::__destroy_vector>::~__exception_guard_exceptions' requested here
  return __exception_guard<_Rollback>(std::move(__rollback));
         ^
eddsa_offline_test.cpp:74:54: note: in instantiation of member function 'std::vector<unsigned char[32]>::vector' requested here
        _preprocessed_data.emplace(key_id, std::move(std::vector<ed25519_scalar_t>(size)));
                                                     ^

…be used in a pseudo-destructor expression

Signed-off-by: kozyilmaz <[email protected]>
@kozyilmaz
Copy link
Contributor Author

a similar version of the error can be found here: https://rextester.com/LAD69246

@ChiaoTeo
Copy link

good pr

@nadav-fireblocks
Copy link
Collaborator

Thank you, we will consider improving this in the next versions

@kozyilmaz
Copy link
Contributor Author

should these be closed due to recent commits?

@nadav-fireblocks
Copy link
Collaborator

@kozyilmaz indeed. closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants