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

build failure on clang 19: deleted operator '=' on atomic #2530

Open
katrinafyi opened this issue Feb 10, 2025 · 1 comment
Open

build failure on clang 19: deleted operator '=' on atomic #2530

katrinafyi opened this issue Feb 10, 2025 · 1 comment

Comments

@katrinafyi
Copy link
Contributor

katrinafyi commented Feb 10, 2025

after fixing #2529, there is another build failure with clang 19. the same failure happens on macos and linux.

souffle> /tmp/nix-build-souffle-2.4.1.drv-0/source/src/interpreter/Index.h:417:14: error: overload resolution selected deleted operator '='
souffle>   417 |         data = src.data;
souffle>       |         ~~~~ ^ ~~~~~~~~
souffle> /nix/store/cvl21fnjrwqcw59vkvhfdfl5w4d0xfaw-libcxx-19.1.6-dev/include/c++/v1/__atomic/atomic.h:58:11: note: candidate function has been explicitly deleted
souffle>    58 |   atomic& operator=(const atomic&)          = delete;
souffle>       |           ^
souffle> /nix/store/cvl21fnjrwqcw59vkvhfdfl5w4d0xfaw-libcxx-19.1.6-dev/include/c++/v1/__atomic/atomic.h:59:11: note: candidate function has been explicitly deleted
souffle>    59 |   atomic& operator=(const atomic&) volatile = delete;
souffle>       |           ^
souffle> /nix/store/cvl21fnjrwqcw59vkvhfdfl5w4d0xfaw-libcxx-19.1.6-dev/include/c++/v1/__atomic/atomic.h:49:29: note: candidate function
souffle>    49 |   _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) volatile _NOEXCEPT {
souffle>       |                             ^
souffle> /nix/store/cvl21fnjrwqcw59vkvhfdfl5w4d0xfaw-libcxx-19.1.6-dev/include/c++/v1/__atomic/atomic.h:53:29: note: candidate function
souffle>    53 |   _LIBCPP_HIDE_FROM_ABI _Tp operator=(_Tp __d) _NOEXCEPT {
souffle>       |                             ^

void insert(const Index& src) {
data = src.data;
}

it looks like the code as written wants to implicitly load/store the atomic by coercing it to a bool, but the compiler is falling back to copy assignment for atomics which is deleted. it looks like the implicit load was deprecated (removed?) in C++ 20: https://en.cppreference.com/w/cpp/atomic/atomic/operator_T

to fix this, it might be possible to add explicit .load() and .store() calls. or, a std::atomic_flag could be used instead. i haven't tried any patches since i'm not familiar with the code.

@quentin
Copy link
Member

quentin commented Feb 11, 2025

I think it is safe to simply replace with data = true here.

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

No branches or pull requests

2 participants